Skip to content

feat: wire motion trigger into components - #4941

Open
mxschll wants to merge 4 commits into
mainfrom
dev-v3-schomax-motion-regions
Open

feat: wire motion trigger into components#4941
mxschll wants to merge 4 commits into
mainfrom
dev-v3-schomax-motion-regions

Conversation

@mxschll

@mxschll mxschll commented Aug 27, 2026

Copy link
Copy Markdown
Member

Adds motion trigger and target attributes to components.

Context: b9VcPdMJ5zRn / NVoiJ1X1df9a.

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

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mxschll mxschll changed the title feat(motion): wire hover/focus motion trigger+target attributes into … feat: wire hover/focus motion trigger+target attributes into components Aug 27, 2026
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.66%. Comparing base (0c1c9fd) to head (e5a0d08).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4941   +/-   ##
=======================================
  Coverage   97.66%   97.66%           
=======================================
  Files         959      959           
  Lines       31345    31364   +19     
  Branches    11579    11591   +12     
=======================================
+ Hits        30614    30633   +19     
+ Misses        724      685   -39     
- Partials        7       46   +39     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mxschll mxschll changed the title feat: wire hover/focus motion trigger+target attributes into components feat: wire hover/focus motion trigger into components Aug 27, 2026
@mxschll
mxschll force-pushed the dev-v3-schomax-motion-regions branch from 01b436b to 0d0aeef Compare September 4, 2026 14:46
@mxschll mxschll changed the title feat: wire hover/focus motion trigger into components feat: wire motion trigger into components Sep 4, 2026
@mxschll
mxschll requested a review from pan-kot September 4, 2026 14:58
ref={ref}
startIcon={startIcon}
endIcon={<InternalIcon name="angle-right" />}
endIcon={<InternalIcon name="angle-right" nativeAttributes={{ 'data-awsui-motion-target': '' }} />}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only want to play animation for the "angle-right" and not custom provided icons, as hovering + focus is coupled with the angle icon action.

Comment thread src/table/header-cell/index.tsx Outdated
'columnDefinitions.editConfig.editIconAriaLabel',
column.editConfig?.editIconAriaLabel
)}
nativeAttributes={{ 'data-awsui-motion-target': '' }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table header is clickable when it is sortable. Clicking on the header causes its sorting direction to change. I believe we should not make the edit icon animate - as it creates confusion.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's valid that the icon has the animation here as its an interactive element, similar like a button. But I agree that when I tried it out, it felt a bit odd. Removing it as it can be added at a later stage again if necessary.

Comment thread src/table/body-cell/index.tsx Outdated
>
<span className={styles['body-cell-editor-icon']}>
<Icon name="edit" />
<Icon name="edit" nativeAttributes={{ 'data-awsui-motion-target': '' }} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a cell is editable - then the entire cell is hover-able and clickable. The semantic button in this case should not act as trigger. Instead - the cell should. Alternatively - we can ignore this completely, as edit button is only visible on hover anyways.

onPointerDown={onPointerDown}
onClick={onClick}
onKeyDown={onKeyDown}
{...(variant === 'drag-indicator'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we only support one variant here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other ones are just horizontal or vertical lines (except the ones with 2 lines) and they would fall back to the default shrinking animation which is almost perceptible for these icons which didn't make sense to animate. The drag-indicator is also the only one with it's custom animation.

<InternalIcon
name={isOneTheme ? 'angle-down' : 'caret-down-filled'}
size={isOneTheme ? 'x-small' : 'normal'}
nativeAttributes={{ 'data-awsui-motion-target': '' }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also animate consumer-provided icons and external link icon in dropdown items?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point 👍

// tabindex=-1 so we can focus them when necessary.
tabIndex={filteringEnabled ? -1 : highlighted ? 0 : -1}
ref={triggerRef}
data-awsui-motion-trigger="hover"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that expand toggles in button dropdown category items also animate when the item is highlighted with the keyboard. How does this work?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semantically, focus can never cover more area than hover. Hovering any part of the region hovers the region, while focus lands on exactly one element, which is either the region itself or a descendant of it. Thats why hover is implicitly hover + focus-visible. But we can move the focus trigger to the children if necessary like in the action card.

We could write it explicit everywhere: `data-awsui-motion-trigger="hover focus" but I decided not to because "hover focus" implies "hover" alone is a valid state, but it never is.

Comment thread src/button/internal.tsx
title: __title ?? ariaLabel,
className: buttonClass,
onClick: handleClick,
'data-awsui-motion-trigger': 'hover',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What these are for: is it for internal buttons only? Why only hover trigger?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per comment above: "hover" implicitly is "hover + focus" because it enforces focus parity. The focus token only exists for designating the focus owner when it's nested inside the hover region.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants