From 4a12c1365fd2551c045c2877bdb6797c4339ecbc Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Tue, 23 Jan 2024 15:12:07 +0100 Subject: [PATCH] fix(NcButton): pressed state a11y - area-pressed should be false when not pressed - pressed should only be present on buttons, not links - fix example to not change text on press Signed-off-by: Grigorii K. Shartsev --- src/components/NcButton/NcButton.vue | 27 ++++--- tests/unit/components/NcButton/button.spec.js | 70 ++++++++++++++----- 2 files changed, 70 insertions(+), 27 deletions(-) diff --git a/src/components/NcButton/NcButton.vue b/src/components/NcButton/NcButton.vue index 33b129928a..961544a1a0 100644 --- a/src/components/NcButton/NcButton.vue +++ b/src/components/NcButton/NcButton.vue @@ -261,26 +261,32 @@ export default { ``` ### Pressed state + It is possible to make the button stateful by adding a pressed state, e.g. if you like to create a favorite button. The button will have the required `aria` attribute for accessibility and visual style (`primary` when pressed, and the configured type otherwise). +Do not change `text` or `aria-label` of the pressed/unpressed button. See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed + ```vue