-
Notifications
You must be signed in to change notification settings - Fork 11
OEL-2127: Add visually-hidden element when there is no label for close button in offcanvas #684
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
base: development
Are you sure you want to change the base?
Conversation
…add a visually-hidden element inside button.
… there is no aria label in close button.
🚀 Deployed on https://preview-684--oelibrary.netlify.app |
@@ -31,6 +31,7 @@ | |||
{% set _with_backdrop = with_backdrop ?? true %} | |||
{% set _with_close = with_close ?? true %} | |||
{% set _close_aria_label = close_aria_label|default('') %} | |||
{% set _close_content = '' %} |
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.
Just a comment about code structure, we can put all parameters that can be set at the top and then variables used by the template.
Another option is to add the parameter, but then the pattern should add it too.
So I'd set by default this after line 77 or so:
{% set _close_content %}
<span class="label visually-hidden">Close</span>
{% endset %}
{% if _close_aria_label %} | ||
{% set _close_attributes = _close_attributes.setAttribute('aria-label', _close_aria_label) %} | ||
{% else %} |
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.
And here we avoid the else:
{% if _close_aria_label %} | |
{% set _close_attributes = _close_attributes.setAttribute('aria-label', _close_aria_label) %} | |
{% else %} | |
{% if _close_aria_label %} | |
{% set _close_attributes = _close_attributes.setAttribute('aria-label', _close_aria_label) %} | |
{% set _close_content = '' %} | |
{% endif %} |
{% set _close_attributes = _close_attributes.setAttribute('aria-label', _close_aria_label) %} | ||
{% else %} | ||
{% set _close_content %} | ||
<span class="label visually-hidden">{{ "Close" }}</span> |
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 wonder if we can add the translation filter here and if we should, this texts may not get translated.
No description provided.