-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[IndexFiltering] #10000
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
[IndexFiltering] #10000
Conversation
|
/snapit |
|
🫰✨ Thanks @zakwarsame! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/polaris-cli@0.0.0-snapshot-release-20230810145959yarn add @shopify/polaris-codemods@0.0.0-snapshot-release-20230810145959yarn add @shopify/polaris-icons@0.0.0-snapshot-release-20230810145959yarn add @shopify/polaris-migrator@0.0.0-snapshot-release-20230810145959yarn add @shopify/polaris@0.0.0-snapshot-release-20230810145959yarn add @shopify/polaris-tokens@0.0.0-snapshot-release-20230810145959yarn add @shopify/stylelint-polaris@0.0.0-snapshot-release-20230810145959 |
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.
Thanks for the contribution @zakwarsame!
I'm not sure of the accessibility implications of defaulting focus to true; wouldn't this steal the focus for every page with an IndexTable, jumping the user directly to the search field? How would a screen reader user handle that?
Relatedly; how would we handle the case when there's more than one <IndexTable> on the page? Which one should receive focus?
Finally, should this also trigger the onQueryFocus() callback?
An alternate solution might be a defaultFocus prop which is passed into useToggle(defaultFocus) + a useEffect() which calls onQueryFocus() once on mount if defaultFocus == true. This leaves the auto-focusing up to the callsite, allowing for more flexibility.
|
@jesstelford I appreciate the feedback!
I think that's a fair point but also, the useOnValueChange hook already runs on every render except the first. It checks the current mode of the I understand why blindly setting it to a. Check if the mode is set to
With the above solution in mind, whichever has the current
Currently,
I think this makes sense. Although, it might be a little redundant to add the prop if the intention is to simply ensure the |
a5aad12 to
a24012e
Compare
a24012e to
f1771ba
Compare
|
/snapit |
|
🫰✨ Thanks @zakwarsame! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/polaris-migrator@0.0.0-snapshot-release-20230830220301yarn add @shopify/polaris@0.0.0-snapshot-release-20230830220301 |
|
Closing in favor of #10284 |
WHY are these changes introduced?
Fixes https://github.com/Shopify/web/pull/100983
modeas Filtering, it makes sense to initialize withmode. This way when the URL includes a query, the input field is focused without accessibility trade-offs.WHAT is this pull request doing?
IndexFiltersModeisFiltering.How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx:🎩 checklist
~ - [ ] Updated the component's
README.mdwith documentation changes~