Fix quantity input +/- buttons decrementing under screen readers - #3976
Open
ZebaAfiaShama wants to merge 1 commit into
Open
Fix quantity input +/- buttons decrementing under screen readers#3976ZebaAfiaShama wants to merge 1 commit into
ZebaAfiaShama wants to merge 1 commit into
Conversation
QuantityInput.onButtonClick used event.target.name to determine which button was pressed. When activated via screen reader/keyboard, the event target resolves to the visually-hidden accessible-name span inside the button (which has no name attribute) rather than the button itself, so the plus button incorrectly fell through to stepDown(). Mouse clicks were unaffected since they hit-test to the button directly. Use event.currentTarget.name instead, matching the pattern already used in the slider's onButtonClick in the same file. Fixes Shopify#3972 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFhzTdXdDnPmBJzysuzKuD
ZebaAfiaShama
force-pushed
the
fix/quantity-input-a11y-3972
branch
from
September 7, 2026 07:50
71a9bbd to
1859ea1
Compare
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
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.
Fixes #3972 line
QuantityInput.onButtonClick
(assets/global.js) usedevent.target.nameto determine which button was pressed. When the button is activated via a screen reader or keyboard,event.targetresolves to the visually-hidden accessible-name span inside the button (which has nonameattribute) rather than the button itself — since that span haspointer-events: autowhile the icon haspointer-events: none. Lacking aname, the check falls through tostepDown()`, so the "+" button decrements the quantity instead of incrementing it. Mouse clicks are unaffected since they hit-test to the button directly.Fix: use
event.currentTargetinstead, which always refers to the element the listener is bound to (the button). This matches the pattern already used in the slider'sonButtonClickin the same file.Before / after
Before (bug —
event.target.name, two occurrences):https://prnt.sc/spD1BXBgWfL4
After (fixed —
event.currentTarget.name, no remaining occurrences):https://prnt.sc/I0n3jufAMiJe
Test plan
event.target.nameoccurrences (lines 249, 261) replaced withevent.currentTarget.nameonButtonClickhandler in the same file