-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add "open" popover styling to buttons #2076
Conversation
apps/react-workshop/cypress-visual-screenshots/baseline/DatePicker.test.ts-Basic.png
Outdated
Show resolved
Hide resolved
apps/react-workshop/cypress-visual-screenshots/baseline/Table.test.ts-Full2.png
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually tested the affected react stories, only found the issue with most of the DatePicker
stories not using the Popover
component. LGTM.
Waiting for @FlyersPh9 to create a PR moving icon fills to field CSS (see thread), because that change will likely affect visuals in this PR. |
#2088 is merging any minute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eba74e9
updates all affected images after merging latest changes.
231481a
to
eba74e9
Compare
Changes
This PR adds "open" state styling to buttons that have a popover (or dropdown menu) that is currently open. Right now, it just reuses hover state styling, which is a subtle, non-offensive choice. (Can be made more noticeable in the future if desired)
Builds upon #2075.
CSS
The hover state is toggled on when the popover is open. This is done at the
iui-button
level (we can think about adding it to other fields in the future if needed).I used a data attribute (
data-iui-has-popover
) and also added:has(+ :popover-open)
as a hook that we can rely on in the future if we use thepopover
API in more places.React
A new
PopoverOpenContext
is exported. Its value is provided in multiple components where a trigger element is present.Button
andIconButton
read from this context and set the data attribute accordingly.Testing
Added unit tests that either directly or indirectly check the affected code paths.
Updated affected visual test images. (Not sure why the focus moved in some cases; probably some flakyness).
Manually tested a whole bunch of stories that are affected. I encourage reviewers to do the same. (Start with DropdownButton for example)
Screen.Recording.2024-05-30.at.4.05.57.PM.mov
Docs
Added changesets for CSS and React.