Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<template data-sly-template.questionMark="${@ componentId, longDescription, bemBlock}">
<button class="${bemBlock}__questionmark" data-sly-test="${longDescription}" title="Help text">
Copy link
Contributor

@im-shiv im-shiv Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is it's open by default? we can show short description by default, it should be conditional

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially tied the aria-expanded attribute to the state of Long Description, which is always initiated as "false".

But, if the short description is showing by default, and the Long Description is still initiated as Hidden, how should I treat the Aria Expanded behavior? When is it True and when is it False?
Because, on click, it only switches between Short and Long description. Is it always Expanded? Is it Expanded only when Short Description is showing? Is it Expanded only when Long Description is showing?

<button class="${bemBlock}__questionmark" data-sly-test="${longDescription}" aria-expanded="false" title="Help text">
</button>
</template>
2 changes: 2 additions & 0 deletions ui.frontend/src/view/FormFieldBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,11 +707,13 @@ class FormFieldBase extends FormField {
if (tooltipAlwaysVisible) {
self.#showHideTooltipDiv(false);
}
questionMarkDiv.setAttribute('aria-expanded', true);
} else {
self.#showHideLongDescriptionDiv(false);
if (tooltipAlwaysVisible) {
self.#showHideTooltipDiv(true);
}
questionMarkDiv.setAttribute('aria-expanded', false);
}
});
}
Expand Down
6 changes: 6 additions & 0 deletions ui.tests/test-module/libs/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,9 @@ Cypress.Commands.add("toggleDescriptionTooltip", (bemBlock, fieldId, shortDescri
//initially long description should have data-cmp-visible="false" to avoid flickering on page load
cy.get(`#${fieldId}`).find(`.${bemBlock}__longdescription`).invoke('attr', 'data-cmp-visible')
.should('eq', 'false');
// check if questiionmark is collapsed
cy.get(`#${fieldId}`).find(`.${bemBlock}__questionmark`).invoke('attr', 'aria-expanded')
.should('eq', 'false');
// click on ? mark
cy.get(`#${fieldId}`).find(`.${bemBlock}__questionmark`).click();
// long description should be shown
Expand All @@ -665,6 +668,9 @@ Cypress.Commands.add("toggleDescriptionTooltip", (bemBlock, fieldId, shortDescri
// short description should be hidden.
cy.get(`#${fieldId}`).find(`.${bemBlock}__shortdescription`).invoke('attr', 'data-cmp-visible')
.should('eq', 'false');
// check if questiionmark is expanded
cy.get(`#${fieldId}`).find(`.${bemBlock}__questionmark`).invoke('attr', 'aria-expanded')
.should('eq', 'true');
});

Cypress.Commands.add("openSidePanelTab", (tab) => {
Expand Down
Loading