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

[IndexFilters] Prevent keyboard shortcuts working if component has no search field or filters #11665

Merged

Conversation

mrcthms
Copy link
Contributor

@mrcthms mrcthms commented Feb 28, 2024

WHY are these changes introduced?

Fixes #11664

Fixes a issue where pressing the F key to toggle the filtering mode of the IndexFilters was still toggling even when the component had no search field or filters. This resulted in the default mode vanishing from the screen and unable to get it back unless one performs a manual refresh of the page.

WHAT is this pull request doing?

Returns early from the keydown event listener if both the hideQueryField and hideFilters props are true.

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Spin URL: https://admin.web.index-filter-keyboard-shortcut.marc-thomas.eu.spin.dev/store/shop1/orders (I've updated the Orders index to remove search and filters to showcase the change)

🎩 checklist

@mrcthms
Copy link
Contributor Author

mrcthms commented Feb 28, 2024

/snapit

Copy link
Contributor

🫰✨ Thanks @mrcthms! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

yarn add @shopify/polaris@0.0.0-snapshot-20240228105807

@martinamarien
Copy link

martinamarien commented Feb 28, 2024

This seems good to me. Thanks Marc!

Interesting though, the hideFilters and hideQueryField props are not in the list of props on the polaris docs. Is that something we could update?

I'll tophat our section in the admin to confirm it's working 👍🏻

@mrcthms mrcthms force-pushed the mrcthms-remove-keyboard-shortcut-on-unneeded-index-filters branch from 1808ba8 to c9bd980 Compare March 4, 2024 11:56
@mrcthms
Copy link
Contributor Author

mrcthms commented Mar 4, 2024

@martinamarien I'll raise that with the Polaris team to see if they can investigate why we don't show the full props here.

Copy link
Member

@chloerice chloerice left a comment

Choose a reason for hiding this comment

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

🙏🏽

.changeset/sour-walls-kneel.md Outdated Show resolved Hide resolved
Co-authored-by: Chloe Rice <chloerice@users.noreply.github.com>
@mrcthms mrcthms merged commit 4263d9a into main Mar 4, 2024
12 checks passed
@mrcthms mrcthms deleted the mrcthms-remove-keyboard-shortcut-on-unneeded-index-filters branch March 4, 2024 17:26
mrcthms pushed a commit that referenced this pull request Mar 5, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @shopify/polaris-icons@8.7.0

### Minor Changes

- [#11682](#11682)
[`9eebf1a45`](9eebf1a)
Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Fixes
clipping on mobile


- [#11686](#11686)
[`9b1b74447`](9b1b744)
Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Update icons
for mobile clipping


- [#11687](#11687)
[`eeea3b96c`](eeea3b9)
Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Minus and
Plus icons to big and unbalanced

### Patch Changes

- [#11685](#11685)
[`ac563025e`](ac56302)
Thanks [@sam-b-rose](https://github.com/sam-b-rose)! - Removed REM units
from SkeletonIcon

## @shopify/polaris@12.20.0

### Minor Changes

- [#11663](#11663)
[`ab2877249`](ab28772)
Thanks [@mrcthms](https://github.com/mrcthms)! - Updated `BulkActions`
to support containing a flat array of actions into a single section
within the ActionList


- [#11674](#11674)
[`042b428be`](042b428)
Thanks [@mrcthms](https://github.com/mrcthms)! - Updated BulkActions to
show titles of sections if provided

### Patch Changes

- [#11670](#11670)
[`c2e443ec9`](c2e443e)
Thanks [@mrcthms](https://github.com/mrcthms)! - Updated IndexTable so
that no bulk actions are required to see the paginated select all text


- [#11684](#11684)
[`75dcb5443`](75dcb54)
Thanks [@mrcthms](https://github.com/mrcthms)! - Updated Actions to
safeguard against incorrect prop shapes being passed to it


- [#11648](#11648)
[`8c7302e11`](8c7302e)
Thanks [@trtri2](https://github.com/trtri2)! - Fixed hover styles to
multiple selection variant of `OptionList`


- [#11665](#11665)
[`4263d9ada`](4263d9a)
Thanks [@mrcthms](https://github.com/mrcthms)! - Fixed `IndexFilters`
responding to keyboard shortcuts when there is no search field or
filters

- Updated dependencies
\[[`ac563025e`](ac56302),
[`9eebf1a45`](9eebf1a),
[`9b1b74447`](9b1b744),
[`eeea3b96c`](eeea3b9)]:
    -   @shopify/polaris-icons@8.7.0

## polaris.shopify.com@0.64.0

### Minor Changes

- [#11674](#11674)
[`042b428be`](042b428)
Thanks [@mrcthms](https://github.com/mrcthms)! - Updated BulkActions to
show titles of sections if provided


- [#11683](#11683)
[`8a0e1b32f`](8a0e1b3)
Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Update design
guidance for icons


- [#11634](#11634)
[`27ca061a6`](27ca061)
Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Adds guidance
on optimzing icons to contribution page

### Patch Changes

- Updated dependencies
\[[`c2e443ec9`](c2e443e),
[`ab2877249`](ab28772),
[`ac563025e`](ac56302),
[`75dcb5443`](75dcb54),
[`042b428be`](042b428),
[`9eebf1a45`](9eebf1a),
[`8c7302e11`](8c7302e),
[`4263d9ada`](4263d9a),
[`9b1b74447`](9b1b744),
[`eeea3b96c`](eeea3b9)]:
    -   @shopify/polaris@12.20.0
    -   @shopify/polaris-icons@8.7.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@martinamarien
Copy link

Thanks for making this fix! 🙏🏻 I tophatted our channel in production and it works great/

sam-b-rose added a commit that referenced this pull request Mar 8, 2024
* main:
  [Icons] Fix icons being clipped on mobile (#11686)
  [IndexFilters] Prevent keyboard shortcuts working if component has no search field or filters (#11665)
  [Actions] Ensure incorrect values are filtered out before iterating (#11684)
AnnaCheba pushed a commit to AnnaCheba/polaris that referenced this pull request Apr 22, 2024
… search field or filters (Shopify#11665)

### WHY are these changes introduced?

Fixes Shopify#11664

Fixes a issue where pressing the F key to toggle the filtering mode of
the IndexFilters was still toggling even when the component had no
search field or filters. This resulted in the default mode vanishing
from the screen and unable to get it back unless one performs a manual
refresh of the page.

### WHAT is this pull request doing?

Returns early from the keydown event listener if both the
`hideQueryField` and `hideFilters` props are `true`.

### How to 🎩

🖥 [Local development
instructions](https://github.com/Shopify/polaris/blob/main/README.md#install-dependencies-and-build-workspaces)
🗒 [General tophatting
guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md)
📄 [Changelog
guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog)

Spin URL:
https://admin.web.index-filter-keyboard-shortcut.marc-thomas.eu.spin.dev/store/shop1/orders
(I've updated the Orders index to remove search and filters to showcase
the change)

### 🎩 checklist

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

---------

Co-authored-by: Chloe Rice <chloerice@users.noreply.github.com>
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.

[IndexFilters] Remove keyboard shortcut if we do not have any filters or search field enabled
3 participants