Skip to content
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

Merged
merged 7 commits into from
Jun 12, 2024
Merged

add "open" popover styling to buttons #2076

merged 7 commits into from
Jun 12, 2024

Conversation

mayank99
Copy link
Contributor

@mayank99 mayank99 commented May 30, 2024

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 the popover API in more places.

React

A new PopoverOpenContext is exported. Its value is provided in multiple components where a trigger element is present.

Button and IconButton 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.

@mayank99 mayank99 marked this pull request as ready for review May 30, 2024 20:15
@mayank99 mayank99 requested review from a team as code owners May 30, 2024 20:15
@mayank99 mayank99 requested review from r100-stack and Ben-Pusey-Bentley and removed request for a team May 30, 2024 20:15
Copy link
Contributor

@Ben-Pusey-Bentley Ben-Pusey-Bentley left a 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.

Base automatically changed from mayank/field-cycle-toggles to main May 31, 2024 20:51
@mayank99
Copy link
Contributor Author

mayank99 commented Jun 3, 2024

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.

@FlyersPh9
Copy link
Collaborator

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.

Copy link
Contributor Author

@mayank99 mayank99 left a 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.

@mayank99 mayank99 enabled auto-merge (squash) June 12, 2024 21:04
@mayank99 mayank99 force-pushed the mayank/popover-open branch from 231481a to eba74e9 Compare June 12, 2024 21:11
@mayank99 mayank99 merged commit 3595174 into main Jun 12, 2024
16 checks passed
@mayank99 mayank99 deleted the mayank/popover-open branch June 12, 2024 21:20
@imodeljs-admin imodeljs-admin mentioned this pull request Jun 12, 2024
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.

4 participants