-
Notifications
You must be signed in to change notification settings - Fork 5
fix(expandable): use aria-expanded attribute - TWIG-103 #199
Conversation
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.
I think you overdid, here...in ECL the only thing was the addition of the default aria-expanded="false".
{% set _button_attributes = [ | ||
{ name: 'aria-controls', value: _aria_controls }, | ||
{ name: 'data-ecl-expandable-toggle', value: true }, | ||
{ name: 'data-ecl-label-expanded', value: _label_expanded }, | ||
{ name: 'data-ecl-label-collapsed', value: _label_collapsed } | ||
{ name: 'data-ecl-label-collapsed', value: _label_collapsed }, | ||
{ name: 'aria-expanded', value: _expanded } |
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.
the aria-expanded attribute is handled by javascript in this component, so we just set it initially as false (at least this is the way it is done in ECL) and then is js playing with that. I see that by doing like you did we could offer the possibility of using the component with a "not-collapsed" state initially, but this is not what the ECL definition of the component does, so i would not introduce it here on our side as an extra parameter.
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.
Agree but this was already the case before the actual PR, I was also a bit confused with this, see the parameter here:
- "expanded" (boolean) (default: false) |
Anyway, I have removed the expanded
parameter now.
@@ -83,7 +75,7 @@ | |||
<div | |||
id="{{ _id ~ '-content' }}" | |||
class="ecl-expandable__content" | |||
{{ _content_hidden_attribute }} | |||
{% if not _expanded %}hidden{% endif %} |
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.
Same as before, this is handled by javascript, we set it as hidden and then js will play with that. I would have honestly considered this as an improvement in case it was meant to provide a non javascript solution with the collapsed button hidden and the content revealed, but it's not the case, so to stick to the definition of the component as we have it ECL we set this as hidden by default and then we leave the task to the js.
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.
Same as my previous comment this was already implemented... See:
{% if _expanded %} |
Updated now.
@papegaill , i had a confirmation on the ECL side about this, personally speaking i would make this as an expandable/collapsible thing, but the collapsible "use case" is already covered by the accordion where we say not to use it with less than three pieces of information, so the single "collapsible" is not an use case, therefore no need to handle any logic on our side. |
PR description
Please drop a few lines about the PR: what it does, how to test it, etc.
QA Checklist
In order to ensure a safe and quick review, please check that your PR follow those guidelines:
devDependencies
devDependencies
include
orembed
) asdependencies
@ecl-twig/ec-components
'sdependencies
yarn.lock
contains changes, I have committed itpr: review needed
to indicate that I'm done and now waiting for a review ,pr: wip
to indicate that I'm actively working on it ...)