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

[OptionList] consolidate se23 styles and logic #10177

Merged
merged 2 commits into from
Aug 24, 2023
Merged

[OptionList] consolidate se23 styles and logic #10177

merged 2 commits into from
Aug 24, 2023

Conversation

gwyneplaine
Copy link
Contributor

@gwyneplaine gwyneplaine commented Aug 23, 2023

WHY are these changes introduced?

Fixes #9953
Fixes #10197

WHAT is this pull request doing?

  • OptionList consolidate se23 logic
  • OptionList consolidate se23 styles
  • Remove custom Checkbox component in favour of the standard Polaris Checkbox
  • Removes the optionRole prop from the OptionList component. This is presently being used to toggle the presentation role on the custom checkbox input. This PR removes this prop for a few reasons:
    • Its no longer used, since the custom Checkbox has been deleted.
    • The functionality it was providing (toggling presentation role) doesn't seem to be supported by browsers. The browser ignores the presentation role on all focusable elements (including inputs). See excerpt from MDN below
    • A cursory Grokt search, rules out internal usage of this prop

Screenshot 2023-08-23 at 10 16 07 am

How to 🎩

  • Storybook
  • Prod storybook

🎩 checklist

);

const checkBoxRole = role === 'option' ? 'presentation' : undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to the MDN the presentation role is ignored on all focusable elements (including inputs), so this would just default back to the implicit 'checkbox' role in the browser.

After a cursory screen reader test, I also couldn't find any behavioural differences from this change.

onChange={handleClick}
/>
) : (
<Checkbox
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we're no longer using the custom checkbox (or exporting it from root), its also deleted in this PR.

@@ -28,8 +26,6 @@ export interface OptionListProps {
options?: OptionDescriptor[];
/** Defines a specific role attribute for the list itself */
role?: 'listbox' | 'combobox' | string;
/** Defines a specific role attribute for each option in the list */
optionRole?: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think removing the prop given the reasons outlined in the PR description is the right thing to do, however I'll defer to the team here as to whether or not we want to deprecate first.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think your grokt search makes this pretty safe to remove, @kyledurand is there a list or somewhere where we are tracking the changed props for v12?

Copy link
Contributor

@laurkim laurkim Aug 23, 2023

Choose a reason for hiding this comment

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

Given the context you provided, if the optionRole prop was only used in Option and with the custom checkbox component that was rendered without the beta flag, I think it makes sense to remove it with the v12 release 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

@gwyneplaine "Component changes" tasklist in this issue can be updated to included optionRole prop removal

@gwyneplaine gwyneplaine force-pushed the v12/9953 branch 6 times, most recently from 4507a3a to 876aa12 Compare August 23, 2023 04:19
@gwyneplaine gwyneplaine linked an issue Aug 23, 2023 that may be closed by this pull request
@gwyneplaine
Copy link
Contributor Author

I'm incredibly stumped as to why this UI test changed. Can't find a specific change in the PR that would lead to the change.
Free bagel to whoever can help me figure it out 😢

@laurkim
Copy link
Contributor

laurkim commented Aug 23, 2023

I'm incredibly stumped as to why this UI test changed. Can't find a specific change in the PR that would lead to the change. Free bagel to whoever can help me figure it out 😢

I wonder if this is coming from the fact that the Bleed component no longer wraps the Box ul? Visually there's no difference but the chromatic baseline on next might be creating a new baseline due to the changes in the rendered elements.

Copy link
Contributor

@laurkim laurkim left a comment

Choose a reason for hiding this comment

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

Nice 🙌 🌟

Copy link
Contributor

@sophschneider sophschneider left a comment

Choose a reason for hiding this comment

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

Nice clean up!! I think the UI baseline is good to approve it might just be a dom change but visually it looks the same to me! idk if that answer warrants a bagel or not 🥯😅

@@ -28,8 +26,6 @@ export interface OptionListProps {
options?: OptionDescriptor[];
/** Defines a specific role attribute for the list itself */
role?: 'listbox' | 'combobox' | string;
/** Defines a specific role attribute for each option in the list */
optionRole?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think your grokt search makes this pretty safe to remove, @kyledurand is there a list or somewhere where we are tracking the changed props for v12?

polaris-react/src/components/OptionList/OptionList.tsx Outdated Show resolved Hide resolved
@@ -76,4 +76,3 @@ Controls in simple option lists are [buttons](https://polaris.shopify.com/compon
If you customize the option list, you can provide ARIA roles that fit the context. These roles must be valid according to the [W3C ARIA specification](https://www.w3.org/TR/wai-aria-1.1/) to be conveyed correctly to screen reader users.

- The `role` prop adds an ARIA role to the option list wrapper
- The `optionRole` prop adds an ARIA role to the option list items
Copy link
Contributor

Choose a reason for hiding this comment

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

@yurm04 would this conflict at all with your polaris.shopify.com changes?

@gwyneplaine gwyneplaine linked an issue Aug 24, 2023 that may be closed by this pull request
@gwyneplaine gwyneplaine merged commit 9621658 into next Aug 24, 2023
16 checks passed
@gwyneplaine gwyneplaine deleted the v12/9953 branch August 24, 2023 01:21
laurkim added a commit that referenced this pull request Aug 25, 2023
### WHY are these changes introduced?

Resolves #10035.

Updates existing `tall-chickens-repeat` changeset with all the component
consolidation work (included any in progress/ready for review/up
next/backlog PRs as well).

Adds changesets for
[OptionList](#10177) `optionRole`
and [Page](#10187) `divider` prop
removal.
sam-b-rose added a commit that referenced this pull request Aug 25, 2023
* next: (87 commits)
  [ButtonGroup] Removed `segmented` boolean prop and replaced with `variant` (#9997)
  [LegacyTabs] Consolidate se23 styles and logic (#10231)
  [v12] Update changesets (#10232)
  [LegacyFilters] Consolidate se23 styles and logic (#10217)
  [Banner] Change status prop to tone (#10206)
  Replace icon highlight color in box stories (#10226)
  [TopBar] Consolidate se23 styles and logic (#10221)
  [Filters] consolidate se23 logic and styles (#10178)
  [Icon] Update props (#10220)
  [ButtonGroup] Update variant plain prop name (#10222)
  [Button] Remove connectedDisclosure (#10182)
  [LegacyCard] Consolidate se23 styles and logic (#10207)
  [Navigation] Consolidate se23 logic and styles (#10213)
  [Frame][ContextualSaveBar] Consolidate se23 styles and logic (#10196)
  [OptionList] consolidate se23 styles and logic  (#10177)
  [Page] Consolidate se23 styles and logic (#10187)
  [DataTable] Consolidate conditional logic (#10169)
  [Thumbnail] Consolidate conditional logic (#10171)
  [ResourceItem] Consolidate conditional logic (#10172)
  [FullscreenBar] Consolidate conditional logic (#10173)
  ...
sam-b-rose added a commit that referenced this pull request Aug 25, 2023
* next: (87 commits)
  [ButtonGroup] Removed `segmented` boolean prop and replaced with `variant` (#9997)
  [LegacyTabs] Consolidate se23 styles and logic (#10231)
  [v12] Update changesets (#10232)
  [LegacyFilters] Consolidate se23 styles and logic (#10217)
  [Banner] Change status prop to tone (#10206)
  Replace icon highlight color in box stories (#10226)
  [TopBar] Consolidate se23 styles and logic (#10221)
  [Filters] consolidate se23 logic and styles (#10178)
  [Icon] Update props (#10220)
  [ButtonGroup] Update variant plain prop name (#10222)
  [Button] Remove connectedDisclosure (#10182)
  [LegacyCard] Consolidate se23 styles and logic (#10207)
  [Navigation] Consolidate se23 logic and styles (#10213)
  [Frame][ContextualSaveBar] Consolidate se23 styles and logic (#10196)
  [OptionList] consolidate se23 styles and logic  (#10177)
  [Page] Consolidate se23 styles and logic (#10187)
  [DataTable] Consolidate conditional logic (#10169)
  [Thumbnail] Consolidate conditional logic (#10171)
  [ResourceItem] Consolidate conditional logic (#10172)
  [FullscreenBar] Consolidate conditional logic (#10173)
  ...
sophschneider pushed a commit that referenced this pull request Sep 19, 2023
<!--
  ☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
  - Start with a verb, for example: Add, Delete, Improve, Fix…
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

### WHY are these changes introduced?

Fixes #9953 
Fixes #10197

### WHAT is this pull request doing?

- `OptionList` consolidate se23 logic
- `OptionList` consolidate se23 styles
- Remove custom `Checkbox` component in favour of the standard Polaris
Checkbox
- Removes the `optionRole` prop from the `OptionList` component. This is
presently being used to toggle the `presentation` role on the custom
checkbox input. This PR removes this prop for a few reasons:
  - Its no longer used, since the custom Checkbox has been deleted. 
- The functionality it was providing (toggling presentation role)
doesn't seem to be [supported by
browsers](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role).
The browser ignores the `presentation` role on all focusable elements
(including inputs). See excerpt from MDN below
- A cursory [Grokt](https://grokt.shopify.io/results?q=optionRole)
search, rules out internal usage of this prop
  
![Screenshot 2023-08-23 at 10 16 07
am](https://github.com/Shopify/polaris/assets/12119389/fbf6718b-ad35-46ee-ad00-6c79840ff02b)

  
### How to 🎩

- Storybook
- Prod storybook

### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide
sophschneider pushed a commit that referenced this pull request Sep 19, 2023
### WHY are these changes introduced?

Resolves #10035.

Updates existing `tall-chickens-repeat` changeset with all the component
consolidation work (included any in progress/ready for review/up
next/backlog PRs as well).

Adds changesets for
[OptionList](#10177) `optionRole`
and [Page](#10187) `divider` prop
removal.
AnnaCheba pushed a commit to AnnaCheba/polaris that referenced this pull request Apr 22, 2024
<!--
  ☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
  - Start with a verb, for example: Add, Delete, Improve, Fix…
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

### WHY are these changes introduced?

Fixes Shopify#9953 
Fixes Shopify#10197

### WHAT is this pull request doing?

- `OptionList` consolidate se23 logic
- `OptionList` consolidate se23 styles
- Remove custom `Checkbox` component in favour of the standard Polaris
Checkbox
- Removes the `optionRole` prop from the `OptionList` component. This is
presently being used to toggle the `presentation` role on the custom
checkbox input. This PR removes this prop for a few reasons:
  - Its no longer used, since the custom Checkbox has been deleted. 
- The functionality it was providing (toggling presentation role)
doesn't seem to be [supported by
browsers](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role).
The browser ignores the `presentation` role on all focusable elements
(including inputs). See excerpt from MDN below
- A cursory [Grokt](https://grokt.shopify.io/results?q=optionRole)
search, rules out internal usage of this prop
  
![Screenshot 2023-08-23 at 10 16 07
am](https://github.com/Shopify/polaris/assets/12119389/fbf6718b-ad35-46ee-ad00-6c79840ff02b)

  
### How to 🎩

- Storybook
- Prod storybook

### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide
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.

OptionList - Remove optionRole prop [OptionList] Consolidate se23 logic and styles
3 participants