react-mdl-extra
react-mdl-extra copied to clipboard
Fix using 2 portals
Fixes #8,
ToDo: [ ] Clicking outside of the Menu should close the Dropdown Dialog. [ ] Test with a dialog Polyfill
I had to nest the open menu within another <dialog>
element, as the browser will not position anything over an open <dialog>
, except for another open <dialog>
.
Feedback is appreciated.
@jguffey, Here are the bugs I found so far:
- The dropdown doesn't collapse when it is onBlur
- Doesn't work in any other browsers other than Chrome.
It is prompted:
- TypeError: this.dialogDom.showModal is not a function[Learn More] bundle.js:49302:8
- TypeError: root is null[Learn More] bundle.js:47327:1
- TypeError: this.dialogDom.showModal is not a function[Learn More]
@zhenyanghua true. @HriBB this project hasn't been updated in some time. If I can get this PR up to spec (passing use case tests that zhenyanghua pointed out, would you be interested in merging this PR?
I am on a long vacation. Will merge when I get back in a week or so 😉 sorry for the delay.
@HriBB Oh! Thanks for checking in, in that case I'll try to address some of the issues @zhenyanghua brought up. I've been using this lib in production, but there are a few issues still holding it back.
The bugs with this PR seem to mostly be related to the use of the <dialog>
component, which is not well supported outside of Chrome at this time. Using a polyfill should fix most of the issues @zhenyanghua pointed out. Personally I've had success with dialog-polyfill. One of my to-do items for this PR is to conduct more testing with this polyfill.
The other issue: "The dropdown doesn't collapse when it is onBlur", is also related to <dialog>
. We want to detect a click on the pseudoelement ::backdrop, but according to this thread that approach may be troublesome in some browsers.
It even breaks other demos? Thanks for checking, I'll look into that.
Clicking outside to close a Portal is a known issue, one I'm not entirely sure how to solve and may not be solvable given the ::backdrop
problem explained in that thread I mentioned.