Conversation
The SliderRoot container carries aria-labelledby and aria-describedby, but reka-ui renders SliderRoot as a container with no role. The element that carries role=slider is SliderThumb, which received no accessible name. Move the aria attributes from SliderRoot to each SliderThumb so the actual slider control has a name. Fixes frappe#994
Contributor
Confidence Score: 4/5The Cypress callback must be corrected before merging because the new regression test fails under the configured runner. The Slider implementation change is sound, but its test invokes Cypress commands from a retried assertion callback that rejects nested commands. Files Needing Attention: src/components/Slider/Slider.cy.ts Reviews (1): Last reviewed commit: "fix(Slider): give role=slider element an..." | Re-trigger Greptile |
Comment on lines
+93
to
+100
| cy.get('[role="slider"]').should(($thumb) => { | ||
| const labelledBy = $thumb.attr('aria-labelledby')! | ||
| const describedBy = $thumb.attr('aria-describedby')! | ||
| expect(labelledBy).to.exist | ||
| expect(describedBy).to.exist | ||
| cy.get(`#${labelledBy}`).should('contain.text', 'Volume') | ||
| cy.get(`#${describedBy}`).should('contain.text', 'Adjust volume.') | ||
| }) |
Contributor
There was a problem hiding this comment.
Nested Cypress commands break test
When Cypress 15 runs this component spec, the .should() callback enqueues two cy.get() commands, which Cypress prohibits inside retried assertion callbacks and causes the regression test to fail.
Suggested change
| cy.get('[role="slider"]').should(($thumb) => { | |
| const labelledBy = $thumb.attr('aria-labelledby')! | |
| const describedBy = $thumb.attr('aria-describedby')! | |
| expect(labelledBy).to.exist | |
| expect(describedBy).to.exist | |
| cy.get(`#${labelledBy}`).should('contain.text', 'Volume') | |
| cy.get(`#${describedBy}`).should('contain.text', 'Adjust volume.') | |
| }) | |
| cy.get('[role="slider"]').then(($thumb) => { | |
| const labelledBy = $thumb.attr('aria-labelledby')! | |
| const describedBy = $thumb.attr('aria-describedby')! | |
| expect(labelledBy).to.exist | |
| expect(describedBy).to.exist | |
| cy.get(`#${labelledBy}`).should('contain.text', 'Volume') | |
| cy.get(`#${describedBy}`).should('contain.text', 'Adjust volume.') | |
| }) |
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.
Summary
Sliderputs its accessible name onSliderRoot, but reka-ui rendersSliderRootas a plain container with no role. The element that actually carriesrole="slider"isSliderThumb, which received noaria-labeland noaria-labelledby— so every slider thumb was an unnamed control (failing WCAG 2.1 SC 4.1.2 Name, Role, Value).This moves the labelling attributes (
aria-labelledby,aria-describedby,aria-errormessage,aria-invalid) fromSliderRootonto eachSliderThumb, so therole="slider"element now has an accessible name.Changes
src/components/Slider/Slider.vue: movearia-labelledby/aria-describedby/aria-errormessage/aria-invalidfromSliderRootto eachSliderThumb.src/components/Slider/Slider.cy.ts: update the shared-labeling test to assert the attributes live on[role="slider"]directly (not on its parent).Test
npm run test:cypress— updatedSlider.cy.tsnow asserts[role="slider"]carries the label and description IDs, and the label/description text resolves through them.Fixes #994