Skip to content

Accept data-bs-body option in the configuration object as well#33248

Merged
GeoSot merged 3 commits into
twbs:mainfrom
GeoSot:use-config-obj-on-offcanvas
Mar 16, 2021
Merged

Accept data-bs-body option in the configuration object as well#33248
GeoSot merged 3 commits into
twbs:mainfrom
GeoSot:use-config-obj-on-offcanvas

Conversation

@GeoSot
Copy link
Copy Markdown
Member

@GeoSot GeoSot commented Mar 2, 2021

Refactor offcanvas to accept config.
In order to use a simple configuration I separated bs-body option to bs-scroll and bs-backdrop

Preview

@GeoSot GeoSot requested a review from a team as a code owner March 2, 2021 23:36
@GeoSot GeoSot mentioned this pull request Mar 2, 2021
4 tasks
@GeoSot GeoSot force-pushed the use-config-obj-on-offcanvas branch 2 times, most recently from a181c28 to e6ecb3e Compare March 3, 2021 00:25
Comment thread js/src/offcanvas.js Outdated
Comment thread js/tests/unit/offcanvas.spec.js Outdated
Comment thread js/tests/unit/offcanvas.spec.js Outdated
Comment thread site/content/docs/5.0/components/offcanvas.md Outdated
Comment thread site/content/docs/5.0/components/offcanvas.md Outdated
@GeoSot GeoSot requested a review from rohit2sharma95 March 3, 2021 22:03
Copy link
Copy Markdown
Contributor

@rohit2sharma95 rohit2sharma95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left few comments, except them LGTM 👍

Comment thread js/src/util/index.js Outdated
Comment thread js/tests/unit/offcanvas.spec.js Outdated
Comment thread js/tests/unit/offcanvas.spec.js Outdated
Comment thread js/src/util/index.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd return false here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure. In code if an element not exists, you don't want to count it as valid. right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the check is for isDisabled. If the element doesn't exist then it can't be disabled?

Copy link
Copy Markdown
Member Author

@GeoSot GeoSot Mar 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we check if a button/anchor/input (or another div) is disabled. Almost in any case it will not be null. The null check is for the 'just in case' situation
I can omitted if you find it more accurate

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer being stricter :) That being said, the logic seems off to me for the aforementioned reason.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another proposal is to throw an exception on line 157.
No-one has checked all these before, so if there is any other opinion I would like to know in order to finalize this

@twbs/js-review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, if the DOM element does not exist it should not be considered as enabled. The absence of the DOM element is also like the disability 🤔

@GeoSot GeoSot force-pushed the use-config-obj-on-offcanvas branch from 140cd7f to 663e16d Compare March 4, 2021 22:02
Copy link
Copy Markdown
Contributor

@rohit2sharma95 rohit2sharma95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Comment thread js/src/offcanvas.js Outdated
Comment thread js/tests/unit/util/index.spec.js Outdated
Comment thread site/content/docs/5.0/components/offcanvas.md Outdated
@XhmikosR XhmikosR requested a review from mdo March 8, 2021 16:38
Comment thread js/src/util/index.js Outdated
@GeoSot GeoSot requested a review from a team as a code owner March 10, 2021 08:48
@XhmikosR XhmikosR force-pushed the use-config-obj-on-offcanvas branch from 9c4035b to bbb8b2f Compare March 10, 2021 12:59
@GeoSot GeoSot force-pushed the use-config-obj-on-offcanvas branch from bbb8b2f to 9ef3d25 Compare March 15, 2021 20:13
@XhmikosR XhmikosR force-pushed the use-config-obj-on-offcanvas branch from 65a810a to 475b920 Compare March 16, 2021 06:54
@XhmikosR XhmikosR force-pushed the use-config-obj-on-offcanvas branch from 475b920 to 1b35d63 Compare March 16, 2021 06:57
@GeoSot GeoSot merged commit ddf72bc into twbs:main Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants