Skip to content
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

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

Merged
merged 3 commits into from Mar 16, 2021

Conversation

GeoSot
Copy link
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
js/src/offcanvas.js Outdated Show resolved Hide resolved
js/tests/unit/offcanvas.spec.js Show resolved Hide resolved
js/tests/unit/offcanvas.spec.js Outdated Show resolved Hide resolved
site/content/docs/5.0/components/offcanvas.md Outdated Show resolved Hide resolved
site/content/docs/5.0/components/offcanvas.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@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 👍

js/src/util/index.js Outdated Show resolved Hide resolved
js/tests/unit/offcanvas.spec.js Outdated Show resolved Hide resolved
js/tests/unit/offcanvas.spec.js Show resolved Hide resolved
@@ -153,6 +153,14 @@ const isVisible = element => {
return false
}

const isDisabled = element => {
if (!element) {
return true
Copy link
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
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
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
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
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
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
Collaborator

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
Collaborator

@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 👍

js/src/offcanvas.js Show resolved Hide resolved
js/tests/unit/util/index.spec.js Outdated Show resolved Hide resolved
site/content/docs/5.0/components/offcanvas.md Outdated Show resolved Hide resolved
@XhmikosR XhmikosR requested a review from mdo March 8, 2021 16:38
@XhmikosR XhmikosR added this to Inbox in v5.0.0-beta3 via automation Mar 10, 2021
js/src/util/index.js Outdated Show resolved Hide resolved
@XhmikosR XhmikosR moved this from Inbox to Review in v5.0.0-beta3 Mar 10, 2021
@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
v5.0.0-beta3 automation moved this from Review to Approved Mar 16, 2021
@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
v5.0.0-beta3 automation moved this from Approved to Done Mar 16, 2021
@GeoSot GeoSot deleted the use-config-obj-on-offcanvas branch March 16, 2021 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
v5.0.0-beta3
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants