-
Notifications
You must be signed in to change notification settings - Fork 0
🎨 Palette: Standardize pagination icon-only buttons for accessibility #1998
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
Open
damacus
wants to merge
1
commit into
main
Choose a base branch
from
palette-pagination-accessibility-10201013275391994045
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,3 @@ | ||
| # Pallete Log | ||
|
|
||
| ## 2024-05-18 - Component icon-only `aria-label` conventions | ||
|
|
||
| **Learning:** Found multiple icon-only components across the Ruby UI layout using `span.sr-only`, but icon-only buttons implemented using `Button` or `Link` components should simply accept the `aria_label:` prop. Ensure it exists. | ||
| **Action:** When working with `<Button>` or `<Link>`, default to setting `aria_label` directly on the component rather than nesting an `sr-only` span. | ||
|
|
||
| ## 2026-03-05 - Swatch pickers need announced selection state | ||
|
|
||
| **Learning:** Visual-only selection rings on theme swatches are not enough; button groups that behave like toggles need `aria-pressed` and a keyboard-visible focus treatment so the current choice is discoverable without sight or a mouse. | ||
| **Action:** Treat palette, theme, and icon swatches as toggle buttons by default: set `type="button"`, expose pressed state, and keep a visible `focus-visible` ring on the interactive element itself. | ||
|
|
||
| ## 2024-03-05 - Add Descriptive Placeholders for Better Guidance | ||
|
|
||
| **Learning:** Form fields lacking `placeholder` attributes (such as the Medication form inputs) can cause user friction since it’s not immediately clear what expected format or type of data to provide, especially on larger, empty textareas like `warnings` or `description`. Adding placeholder text does not break existing test locators compared to changing ARIA labels. | ||
| **Action:** When working with forms or input fields via `RubyUI::Input` or `RubyUI::Textarea`, add a corresponding translated placeholder where appropriate to guide users effectively without cluttering the UI with additional helper text. | ||
| ## 2024-03-24 - Phlex Pagination Accessibility Refactoring | ||
| **Learning:** When refactoring icon-only buttons for accessibility in Phlex components, be cautious of Phlex's block rendering semantics. Returning a string literal inside a Phlex block (e.g., `span { '‹' }`) does not output the text; you must explicitly use the `plain` helper (e.g., `span { plain '‹' }`). Also, when applying `aria-label` to disabled placeholder elements (like a generic non-interactive `span`), remember to include `role="button"` and `aria-disabled="true"` so screen readers correctly identify the element as a disabled interactive control instead of ignoring the `aria-label`. | ||
| **Action:** Always use `plain` for text nodes in Phlex blocks and pair `aria-label` with an appropriate interactive role (`role="button"`) and state (`aria-disabled="true"`) when mocking disabled buttons with plain `span` elements. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,15 +92,19 @@ | |
| href: page_url(pagy_obj.previous), | ||
| variant: :link, | ||
| class: nav_button_class('rounded-l-md'), | ||
| data: { turbo_frame: 'admin-users-frame' } | ||
| data: { turbo_frame: 'admin-users-frame' }, | ||
| "aria-label": t('admin.users.pagination.previous') | ||
| ) do | ||
| span(class: 'sr-only') { t('admin.users.pagination.previous') } | ||
| plain '‹' | ||
| span(aria_hidden: 'true') { plain '‹' } | ||
|
Comment on lines
+95
to
+98
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔍 Pagination tests still require removed markup Existing component specs still require Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| end | ||
| else | ||
| span(class: "#{nav_button_class('rounded-l-md')} opacity-50 cursor-not-allowed") do | ||
| span(class: 'sr-only') { t('admin.users.pagination.previous') } | ||
| plain '‹' | ||
| span( | ||
| class: "#{nav_button_class('rounded-l-md')} opacity-50 cursor-not-allowed", | ||
| role: 'button', | ||
| "aria-disabled": 'true', | ||
| "aria-label": t('admin.users.pagination.previous') | ||
| ) do | ||
| span(aria_hidden: 'true') { plain '‹' } | ||
| end | ||
| end | ||
| end | ||
|
|
@@ -111,15 +115,19 @@ | |
| href: page_url(pagy_obj.next), | ||
| variant: :link, | ||
| class: nav_button_class('rounded-r-md'), | ||
| data: { turbo_frame: 'admin-users-frame' } | ||
| data: { turbo_frame: 'admin-users-frame' }, | ||
| "aria-label": t('admin.users.pagination.next') | ||
| ) do | ||
| span(class: 'sr-only') { t('admin.users.pagination.next') } | ||
| plain '›' | ||
| span(aria_hidden: 'true') { plain '›' } | ||
| end | ||
| else | ||
| span(class: "#{nav_button_class('rounded-r-md')} opacity-50 cursor-not-allowed") do | ||
| span(class: 'sr-only') { t('admin.users.pagination.next') } | ||
| plain '›' | ||
| span( | ||
| class: "#{nav_button_class('rounded-r-md')} opacity-50 cursor-not-allowed", | ||
| role: 'button', | ||
| "aria-disabled": 'true', | ||
| "aria-label": t('admin.users.pagination.next') | ||
| ) do | ||
| span(aria_hidden: 'true') { plain '›' } | ||
| end | ||
| end | ||
| end | ||
|
|
||
Oops, something went wrong.
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.
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.
🔍 Unrelated palette guidance disappears
The new pagination entry deletes three unrelated lessons and the log heading. This broad history rewrite conflicts with the repository’s atomic-change rule.
Was this helpful? React with 👍 or 👎 to provide feedback.