feat: wire hover/focus motion trigger into components - #4941
Draft
mxschll wants to merge 18 commits into
Draft
Conversation
…buttons and carets Wires the existing data-awsui-motion-trigger / data-awsui-motion-target selector mechanism (already in src/icon/hover-motion.scss) into real components. The CSS engine itself was not changed. - InternalButton (src/button/internal.tsx, icon-helper.tsx): every rendered button/anchor sets data-awsui-motion-trigger="hover"; every icon it renders (leading/trailing via IconWrapper, plus the appended external-link icon) sets data-awsui-motion-target. Covers Button, ButtonDropdown (all trigger shapes incl. split main-action), the ButtonGroup icon-button items, and ToggleButton, since they all share this one primitive. - ExpandableSection caret (src/expandable-section/expandable-section-header.tsx): the shared caret <InternalIcon> always carries data-awsui-motion-target; data-awsui-motion-trigger="hover" is set on whichever element already owns the click handler (the standalone caret button, the deprecated role=button header, or whichever of headerButton/HeadingTag/wrapper currently receives the click listeners) so the hover surface always matches the real clickable area. SideNavigation's expandable link groups render through this same navigation-variant caret, so they are covered without a separate change. - Tests: src/icon/__tests__/icon-hover-motion.test.ts gains a suite covering the descendant-target-under-hover case, the descendant-target- under-focus (nested trigger) case, the trigger-and-target-on-the-same- element case, an icon outside any target staying still, and disableMotion()/prefers-reduced-motion still neutralising the new selectors. New DOM-attribute assertions were added to button/__tests__/internal.test.tsx and expandable-section/__tests__/expandable-section.test.tsx.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4941 +/- ##
=======================================
Coverage 97.66% 97.66%
=======================================
Files 958 959 +1
Lines 31326 31348 +22
Branches 11573 11582 +9
=======================================
+ Hits 30594 30616 +22
- Misses 686 725 +39
+ Partials 46 7 -39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related links, issue #, if available: n/a
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.