-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[BulkActions] Fixed index table and resource list ignoring selection #8099
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…lk actions Co-authored-by: Amy Fairbrother <amy.fairbrother@shopify.com> Co-authored-by: Andrew Musgrave <andrew.musgrave@shopify.com>
Contributor
size-limit report 📦
|
chloerice
approved these changes
Jan 24, 2023
Member
chloerice
left a comment
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 fixing this @AndrewMusgrave!! ![]()
mrcthms
approved these changes
Jan 25, 2023
Contributor
mrcthms
left a comment
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.
Love to see it 🙌
Co-authored-by: Chloe Rice <chloerice@users.noreply.github.com>
Merged
yurm04
pushed a commit
that referenced
this pull request
Jan 26, 2023
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@6.10.0 ### Minor Changes - [#8150](#8150) [`a0c6e467b`](a0c6e46) Thanks [@leileu](https://github.com/leileu)! - Adding two metaobject icons: Metaobject and Metaobject Reference. ### Patch Changes - [#8148](#8148) [`0ca0b7899`](0ca0b78) Thanks [@zecarlostorre](https://github.com/zecarlostorre)! - Updated clipboard icon ## @shopify/polaris@10.24.0 ### Minor Changes - [#8083](#8083) [`18991daf1`](18991da) Thanks [@krithikajanakiraman](https://github.com/krithikajanakiraman)! - Adding an oprtional headerContent prop to ResourceList - [#7821](#7821) [`a0941743a`](a094174) Thanks [@laurkim](https://github.com/laurkim)! - Rebuilt `ActionList` to use layout primitives - [#7821](#7821) [`a0941743a`](a094174) Thanks [@laurkim](https://github.com/laurkim)! - Refactored `SkeletonPage` to use primitive Layout components Removed `max-width` on children in `AlphaStack` Added `narrowWidth` and `fullWidth` examples to `AlphaStack` stories ### Patch Changes - [#7821](#7821) [`a0941743a`](a094174) Thanks [@laurkim](https://github.com/laurkim)! - Updated `SkeletonPage` title and body layout - [#7821](#7821) [`a0941743a`](a094174) Thanks [@laurkim](https://github.com/laurkim)! - Refactored `SkeletonPage` title layout - [#7821](#7821) [`a0941743a`](a094174) Thanks [@laurkim](https://github.com/laurkim)! - Fixed `ResourceList` header alignment - [#7821](#7821) [`a0941743a`](a094174) Thanks [@laurkim](https://github.com/laurkim)! - Rebuilt `ResourceItem` with layout components - [#7821](#7821) [`a0941743a`](a094174) Thanks [@laurkim](https://github.com/laurkim)! - Fixed IndexTable checkbox alignment - [#8099](#8099) [`a3605c855`](a3605c8) Thanks [@AndrewMusgrave](https://github.com/AndrewMusgrave)! - Fixed `BulkActions` causing `IndexTable` & `ResourceList` to ignore pointer events - Updated dependencies \[[`a0c6e467b`](a0c6e46), [`0ca0b7899`](0ca0b78)]: - @shopify/polaris-icons@6.10.0 ## @shopify/plugin-polaris@0.0.31 ### Patch Changes - Updated dependencies \[]: - @shopify/polaris-migrator@0.11.2 ## @shopify/polaris-migrator@0.11.2 ### Patch Changes - Updated dependencies \[[`07669075a`](0766907), [`74a75a473`](74a75a4), [`f8f9eecd5`](f8f9eec)]: - @shopify/stylelint-polaris@5.1.2 ## @shopify/stylelint-polaris@5.1.2 ### Patch Changes - [#8167](#8167) [`07669075a`](0766907) Thanks [@aaronccasanova](https://github.com/aaronccasanova)! - Temporarily disable layout category - [#8162](#8162) [`74a75a473`](74a75a4) Thanks [@aaronccasanova](https://github.com/aaronccasanova)! - Allow SCSS namespaces with Polaris breakpoints - [#8168](#8168) [`f8f9eecd5`](f8f9eec) Thanks [@aaronccasanova](https://github.com/aaronccasanova)! - Ignored needless disables for layout category and added meta URL to error message ## polaris.shopify.com@0.30.1 ### Patch Changes - [#8123](#8123) [`3bb6c03d3`](3bb6c03) Thanks [@marlowpayne](https://github.com/marlowpayne)! - Improve readability of markdown tables by wrapping on words - [#8045](#8045) [`b3ee45c47`](b3ee45c) Thanks [@sarahill](https://github.com/sarahill)! - Added component lifecycle page to polaris.shopify.com - [#7821](#7821) [`a0941743a`](a094174) Thanks [@laurkim](https://github.com/laurkim)! - Rebuilt `ActionList` to use layout primitives - Updated dependencies \[[`a0941743a`](a094174), [`18991daf1`](18991da), [`a0941743a`](a094174), [`a0941743a`](a094174), [`a0941743a`](a094174), [`a0941743a`](a094174), [`a0941743a`](a094174), [`a0941743a`](a094174), [`a0c6e467b`](a0c6e46), [`a3605c855`](a3605c8), [`0ca0b7899`](0ca0b78)]: - @shopify/polaris@10.24.0 - @shopify/polaris-icons@6.10.0 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Merged
juzser
pushed a commit
to juzser/polaris
that referenced
this pull request
Jul 27, 2023
…hopify#8099) ### WHY are these changes introduced? The new bulk actions UI was causing pointer events to be blocked, resulting in index table & resource being unselectable. ### Screenies #### Index table non-sticky <img width="1084" alt="Screenshot 2023-01-19 at 11 29 58 AM" src="https://user-images.githubusercontent.com/24610840/213503423-6217abb4-233e-4fef-984f-9d62c88b398b.png"> #### Index table sticky <img width="1034" alt="Screenshot 2023-01-19 at 11 30 18 AM" src="https://user-images.githubusercontent.com/24610840/213503548-c6650bc5-d93c-4f27-8619-169bd3da92ea.png"> #### Index table sticky with bulk actions open <img width="1017" alt="Screenshot 2023-01-19 at 11 30 35 AM" src="https://user-images.githubusercontent.com/24610840/213503637-9c4148b5-a4b4-48c7-8659-b3951def9566.png"> #### Resource list row selected <img width="1264" alt="Screenshot 2023-01-19 at 11 31 43 AM" src="https://user-images.githubusercontent.com/24610840/213503687-80a51704-c55a-4bd2-8f58-e31d44e7deb7.png"> #### Resource list row selected with bulk actions open <img width="1251" alt="Screenshot 2023-01-19 at 11 31 50 AM" src="https://user-images.githubusercontent.com/24610840/213503762-ee02e18d-1013-4d06-b023-bcbfeb5df9b7.png"> ### WHAT is this pull request doing? Adjusting pointer events ### How to 🎩 Playground code included if needed <details> <summary>Copy-paste this code in <code>playground/Playground.tsx</code>:</summary> ```jsx import React, {useState, useCallback} from 'react'; import { Page, TextField, IndexTable, Card, Filters, Select, useIndexResourceState, Text, } from '../src'; export function Playground() { return ( <Page title="Playground"> <IndexTableWithAllElementsExample /> </Page> ); } const customers = Array.from({length: 50}).map((_, i) => ({ id: i, url: `customers/${i}`, name: 'Mae Jemison', location: 'Decatur, USA', orders: 20, amountSpent: '$2,400', })); function IndexTableWithAllElementsExample() { const resourceName = { singular: 'customer', plural: 'customers', }; const {selectedResources, allResourcesSelected, handleSelectionChange} = useIndexResourceState(customers); const [taggedWith, setTaggedWith] = useState('VIP'); const [queryValue, setQueryValue] = useState(null); const [sortValue, setSortValue] = useState('today'); const handleTaggedWithChange = useCallback( (value) => setTaggedWith(value), [], ); const handleTaggedWithRemove = useCallback(() => setTaggedWith(null), []); const handleQueryValueRemove = useCallback(() => setQueryValue(null), []); const handleClearAll = useCallback(() => { handleTaggedWithRemove(); handleQueryValueRemove(); }, [handleQueryValueRemove, handleTaggedWithRemove]); const handleSortChange = useCallback((value) => setSortValue(value), []); const promotedBulkActions = [ { content: 'Edit customers', onAction: () => console.log('Todo: implement bulk edit'), }, ]; const bulkActions = [ { content: 'Add tags', onAction: () => console.log('Todo: implement bulk add tags'), }, { content: 'Remove tags', onAction: () => console.log('Todo: implement bulk remove tags'), }, { content: 'Delete customers', onAction: () => console.log('Todo: implement bulk delete'), }, ]; const filters = [ { key: 'taggedWith', label: 'Tagged with', filter: ( <TextField label="Tagged with" value={taggedWith} onChange={handleTaggedWithChange} autoComplete="off" labelHidden /> ), shortcut: true, }, ]; const appliedFilters = !isEmpty(taggedWith) ? [ { key: 'taggedWith', label: disambiguateLabel('taggedWith', taggedWith), onRemove: handleTaggedWithRemove, }, ] : []; const sortOptions = [ {label: 'Today', value: 'today'}, {label: 'Yesterday', value: 'yesterday'}, {label: 'Last 7 days', value: 'lastWeek'}, ]; const rowMarkup = customers.map( ({id, name, location, orders, amountSpent}, index) => ( <IndexTable.Row id={id} key={id} selected={selectedResources.includes(id)} position={index} > <IndexTable.Cell> <Text variant="bodyMd" fontWeight="bold" as="span"> {name} </Text> </IndexTable.Cell> <IndexTable.Cell>{location}</IndexTable.Cell> <IndexTable.Cell>{orders}</IndexTable.Cell> <IndexTable.Cell>{amountSpent}</IndexTable.Cell> </IndexTable.Row> ), ); return ( <Card> <div style={{padding: '16px', display: 'flex'}}> <div style={{flex: 1}}> <Filters queryValue={queryValue} filters={filters} appliedFilters={appliedFilters} onQueryChange={setQueryValue} onQueryClear={handleQueryValueRemove} onClearAll={handleClearAll} /> </div> <div style={{paddingLeft: '0.25rem'}}> <Select labelInline label="Sort by" options={sortOptions} value={sortValue} onChange={handleSortChange} /> </div> </div> <IndexTable resourceName={resourceName} itemCount={customers.length} selectedItemsCount={ allResourcesSelected ? 'All' : selectedResources.length } onSelectionChange={handleSelectionChange} hasMoreItems bulkActions={bulkActions} promotedBulkActions={promotedBulkActions} lastColumnSticky headings={[ {title: 'Name'}, {title: 'Location'}, {title: 'Order count'}, {title: 'Amount spent', hidden: false}, ]} > {rowMarkup} </IndexTable> </Card> ); function disambiguateLabel(key, value) { switch (key) { case 'taggedWith': return `Tagged with ${value}`; default: return value; } } function isEmpty(value) { if (Array.isArray(value)) { return value.length === 0; } else { return value === '' || value == null; } } } ``` </details> ### 🎩 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 Co-authored-by: Amy Fairbrother <amy.fairbrother@shopify.com> Co-authored-by: Chloe Rice <chloerice@users.noreply.github.com>
juzser
pushed a commit
to juzser/polaris
that referenced
this pull request
Jul 27, 2023
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@6.10.0 ### Minor Changes - [Shopify#8150](Shopify#8150) [`a0c6e467b`](Shopify@a0c6e46) Thanks [@leileu](https://github.com/leileu)! - Adding two metaobject icons: Metaobject and Metaobject Reference. ### Patch Changes - [Shopify#8148](Shopify#8148) [`0ca0b7899`](Shopify@0ca0b78) Thanks [@zecarlostorre](https://github.com/zecarlostorre)! - Updated clipboard icon ## @shopify/polaris@10.24.0 ### Minor Changes - [Shopify#8083](Shopify#8083) [`18991daf1`](Shopify@18991da) Thanks [@krithikajanakiraman](https://github.com/krithikajanakiraman)! - Adding an oprtional headerContent prop to ResourceList - [Shopify#7821](Shopify#7821) [`a0941743a`](Shopify@a094174) Thanks [@laurkim](https://github.com/laurkim)! - Rebuilt `ActionList` to use layout primitives - [Shopify#7821](Shopify#7821) [`a0941743a`](Shopify@a094174) Thanks [@laurkim](https://github.com/laurkim)! - Refactored `SkeletonPage` to use primitive Layout components Removed `max-width` on children in `AlphaStack` Added `narrowWidth` and `fullWidth` examples to `AlphaStack` stories ### Patch Changes - [Shopify#7821](Shopify#7821) [`a0941743a`](Shopify@a094174) Thanks [@laurkim](https://github.com/laurkim)! - Updated `SkeletonPage` title and body layout - [Shopify#7821](Shopify#7821) [`a0941743a`](Shopify@a094174) Thanks [@laurkim](https://github.com/laurkim)! - Refactored `SkeletonPage` title layout - [Shopify#7821](Shopify#7821) [`a0941743a`](Shopify@a094174) Thanks [@laurkim](https://github.com/laurkim)! - Fixed `ResourceList` header alignment - [Shopify#7821](Shopify#7821) [`a0941743a`](Shopify@a094174) Thanks [@laurkim](https://github.com/laurkim)! - Rebuilt `ResourceItem` with layout components - [Shopify#7821](Shopify#7821) [`a0941743a`](Shopify@a094174) Thanks [@laurkim](https://github.com/laurkim)! - Fixed IndexTable checkbox alignment - [Shopify#8099](Shopify#8099) [`a3605c855`](Shopify@a3605c8) Thanks [@AndrewMusgrave](https://github.com/AndrewMusgrave)! - Fixed `BulkActions` causing `IndexTable` & `ResourceList` to ignore pointer events - Updated dependencies \[[`a0c6e467b`](Shopify@a0c6e46), [`0ca0b7899`](Shopify@0ca0b78)]: - @shopify/polaris-icons@6.10.0 ## @shopify/plugin-polaris@0.0.31 ### Patch Changes - Updated dependencies \[]: - @shopify/polaris-migrator@0.11.2 ## @shopify/polaris-migrator@0.11.2 ### Patch Changes - Updated dependencies \[[`07669075a`](Shopify@0766907), [`74a75a473`](Shopify@74a75a4), [`f8f9eecd5`](Shopify@f8f9eec)]: - @shopify/stylelint-polaris@5.1.2 ## @shopify/stylelint-polaris@5.1.2 ### Patch Changes - [Shopify#8167](Shopify#8167) [`07669075a`](Shopify@0766907) Thanks [@aaronccasanova](https://github.com/aaronccasanova)! - Temporarily disable layout category - [Shopify#8162](Shopify#8162) [`74a75a473`](Shopify@74a75a4) Thanks [@aaronccasanova](https://github.com/aaronccasanova)! - Allow SCSS namespaces with Polaris breakpoints - [Shopify#8168](Shopify#8168) [`f8f9eecd5`](Shopify@f8f9eec) Thanks [@aaronccasanova](https://github.com/aaronccasanova)! - Ignored needless disables for layout category and added meta URL to error message ## polaris.shopify.com@0.30.1 ### Patch Changes - [Shopify#8123](Shopify#8123) [`3bb6c03d3`](Shopify@3bb6c03) Thanks [@marlowpayne](https://github.com/marlowpayne)! - Improve readability of markdown tables by wrapping on words - [Shopify#8045](Shopify#8045) [`b3ee45c47`](Shopify@b3ee45c) Thanks [@sarahill](https://github.com/sarahill)! - Added component lifecycle page to polaris.shopify.com - [Shopify#7821](Shopify#7821) [`a0941743a`](Shopify@a094174) Thanks [@laurkim](https://github.com/laurkim)! - Rebuilt `ActionList` to use layout primitives - Updated dependencies \[[`a0941743a`](Shopify@a094174), [`18991daf1`](Shopify@18991da), [`a0941743a`](Shopify@a094174), [`a0941743a`](Shopify@a094174), [`a0941743a`](Shopify@a094174), [`a0941743a`](Shopify@a094174), [`a0941743a`](Shopify@a094174), [`a0941743a`](Shopify@a094174), [`a0c6e467b`](Shopify@a0c6e46), [`a3605c855`](Shopify@a3605c8), [`0ca0b7899`](Shopify@0ca0b78)]: - @shopify/polaris@10.24.0 - @shopify/polaris-icons@6.10.0 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
The new bulk actions UI was causing pointer events to be blocked, resulting in index table & resource being unselectable.
Screenies
Index table non-sticky
Index table sticky
Index table sticky with bulk actions open
Resource list row selected
Resource list row selected with bulk actions open
WHAT is this pull request doing?
Adjusting pointer events
How to 🎩
Playground code included if needed
Copy-paste this code in
playground/Playground.tsx:🎩 checklist
README.mdwith documentation changes