Skip to content

Commit

Permalink
[Checkbox] Fix shift click (Shopify#11810)
Browse files Browse the repository at this point in the history
### WHY are these changes introduced?

Fixes Shopify#11809


https://bugzilla.mozilla.org/show_bug.cgi?id=559506#:~:text=18%20days%20ago-,If%20you%20shift%2Bclick%20or%20ctrl%2Bclick%20on%20a%20label,checkbox%2C%20checkbox%20is%20not%20checked.

### WHAT is this pull request doing?

This PR changes our checkbox input from being 1px / 1px hidden, to full
size with opactiy 0. So the click event gets triggered.

### How to 🎩


[Spin](https://admin.web.checkbox.kyle-durand.us.spin.dev/store/shop1/orders)

### 🎩 checklist

- [ ] Tested a
[snapshot](https://github.com/Shopify/polaris/blob/main/documentation/Releasing.md#-snapshot-releases)
- [ ] 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: Chloe Rice <chloerice@users.noreply.github.com>
  • Loading branch information
kyledurand and chloerice committed Apr 2, 2024
1 parent 9dc453d commit 18a013a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-timers-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': patch
---

Fixed Shift + click selection of `IndexTable.Row` not working in Firefox
8 changes: 6 additions & 2 deletions polaris-react/src/components/Checkbox/Checkbox.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@

/* stylelint-disable selector-max-specificity, selector-max-class, selector-max-combinators, max-nesting-depth -- Much easier to read the rules when written like this */
.Input {
/* stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY */
@mixin visually-hidden;
position: absolute;
z-index: var(--p-z-index-1);
width: 100%;
height: 100%;
opacity: 0;
margin: 0;

&:focus-visible {
+ .Backdrop {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const Checkbox = memo(function Checkbox({
const {resourceName} = useIndexValue();
const {itemId, selected, disabled, onInteraction} = useContext(RowContext);

const wrapperClassName = classNames(styles.Wrapper);
const label = accessibilityLabel
? accessibilityLabel
: i18n.translate('Polaris.IndexTable.selectItem', {
Expand All @@ -33,11 +32,7 @@ export const Checkbox = memo(function Checkbox({
return (
<CheckboxWrapper>
<div className={styles.TableCellContentContainer}>
<div
className={wrapperClassName}
onClick={onInteraction}
onKeyUp={noop}
>
<div className={styles.Wrapper} onClick={onInteraction} onKeyUp={noop}>
<PolarisCheckbox
id={`Select-${itemId}`}
label={label}
Expand Down

0 comments on commit 18a013a

Please sign in to comment.