Problem/Motivation
The README.mdx file for the offcanvas component lists the backdrop property as a boolean, but if it is used this way it will not work correctly as the logic for setting a default value depends on a string.
If false is passed to this component instead of 'false' the resulting value from the following code will be 'true'.
{% set backdrop = backdrop|default('true') %}
The comments in offcanvas.twig accurately define this:
* - backdrop: (optional) Backdrop: 'true' | 'false' | 'static'.
The definition in README.mdx shows:
- `backdrop` (bool) (default: true): Backdrop.
Proposed resolution
Update the README, defining this as a string instead of a bool.
Issue fork radix-3526166
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 #3
cyu commentedComment #4
cyu commentedComment #7
doxigo commentedThanks a lot Christopher, merged and updated the https://radix.trydrupal.com/radix/components/offcanvas as well
I noticed some duplicates there as well, that aside I wonder if we should make that into a boolean instead of string.
Would appreciate another MR
Comment #8
cyu commentedYeah, a value of "static" shouldn't be doing anything there, based on https://getbootstrap.com/docs/5.0/components/offcanvas/#options, so switching to boolean looks like the right move.
https://getbootstrap.com/docs/5.0/components/modal/#options accepts "static" plus boolean values, but that Radix modal component looks like it only supports setting to "static" or not setting a data-bs-backdrop value (defaulting to true), with no way to set data-bs-backdrop="false"