Problem/Motivation
Toast template uses data attribute data-delay however it has no effect since in bootstrap5 the correct attribute is data-bs-delay so the toast is open for 5 seconds instead of 10 seconds as in the template. See the docs here https://getbootstrap.com/docs/5.3/components/toasts/#options
Also I think it would be nice to have the delay configurable in the theme options?
Steps to reproduce
- Go to theme settings
/admin/appearance/settings/bootstrap_barrio - Select the
Componentstab - Expand
Messagesaccordion - Select
ToastsfromMessages widgetdropdown - Save the settings
- Go to
/user/loginpage and enter invalid credentials - Page displays the error in a toast
- Toast is open for 5 seconds instead of 10 seconds
Proposed resolution
Fix the data-delay attribute in the template
Optional: Add a theme setting that controls how long the toast is opened and fix the template to use the setting
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | styles.png | 66.67 KB | bcizej |
| #6 | styles-breaking.png | 213.24 KB | ravi kant |
Issue fork bootstrap_barrio-3452394
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
ravi kant commented@bcizej
The theme is not providing option to set delay option but you can do in your custom theme.
Comment #3
ravi kant commentedComment #5
bcizej commented@ravi kant
Yes, I managed to add settings field and overrided the toasts template to load the proper attribute from config in a custom sub theme.
I added a PR that fixes the template and adds a new setting field. I don't know if this will be merged but it might be helpful for others on how to modify their sub theme if needed.
Comment #6
ravi kant commented@bcizej
I checked the branch and found that the option is available now but has no default value. Also, the style is breaking.
Comment #7
bcizej commented@ravi kant
There is an update hook that sets the default value via
drush updb. I don't see any style breaking on my side.Comment #9
hatuhay commented