-
Notifications
You must be signed in to change notification settings - Fork 12
UCPKN-3880: Pass attributes to modal and toast sections. #693
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
Conversation
🚀 Deployed on https://preview-693--oelibrary.netlify.app |
{% if _with_body_wrapper %} | ||
</div> | ||
{% endif %} | ||
{{- _toast.custom_content|default('') -}} |
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.
{ | ||
role: "alert", | ||
aria_live: "assertive", | ||
with_close: false, |
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.
can we add another test without close?
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.
you can use the same data, but overwritting in test like this:
render({ ...demoData, with_close: false }),
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.
Test added.
src/data/toasts/data.js
Outdated
with_close: true, | ||
header: "Toast title", | ||
header_attributes: new drupalAttribute().addClass("test-class"), | ||
button_attributes: new drupalAttribute().addClass("test-class"), |
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've updated in another pr the drupalAttributes package and when that pr is going to be merged we will need to change to DrupalAttribute from drupalAttribute.. I will take care of it, no worries
<div{{ _body_attributes.addClass(['toast-body']) }}> | ||
{{- _body -}} | ||
</div> | ||
{% if _with_body_wrapper %} |
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 we didnt approach correctly these toasts in the first version and now with your changes, it becomes even more complex.. I think we can simplify it but I need to think of the impact
I dont like: _body_wrapper_classes _with_body_wrapper parameters and by removing them we would have a more simple template. We can leave it like this for now.
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.
Yes, I was also wondering about the body wrapper (there's no mention of that in the Bootstrap docs).
{% set button_attributes = create_attribute() | ||
{% set _button_attributes = _button_attributes | ||
.addClass(['btn-close']) | ||
.setAttribute('aria-label', 'close') |
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 would change this as if _button_attributes has aria-label attribute it would be overwritten by this
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.
Fixed it, also made the label capitalized 'Close', because that's the convention in other components (alert, modal).
Thanks @kp77 for this, 2 small points to update:
|
No description provided.