liferay / clay

A web implementation of the Lexicon Experience Language
http://clayui.com
Other
208 stars 467 forks source link

fix(@clayui/core): LPS-203851 fixes bug when keeping DropDown open in TreeView actions in Firefox #5765

Closed matuzalemsteles closed 4 months ago

matuzalemsteles commented 4 months ago

Ticket LPS-203851

Well, basically this is a follow-up fix where the original fix only fixed the bug in Chrome and still kept reproducing in Firefox. After some tests it seems that the problem was always happening when the DropDown Item is a link, when clicking on the link the TreeView node's blur event is triggered first than the dropdown item, causing the dropdown trigger to disappear and the menu was repositioned and for some reason it didn't trigger the click on the DropDown item afterwards. I still haven't found a clear explanation about this behavior and because it happens in Firefox, my assumption is still the order of events and perhaps the cancellation midway.

To prevent the DropDown trigger from disappearing, I'm just adding that in the blur of the TreeView node the event.relatedTarget is different from null or undefined, this does the trick because the click needs to be on some valid node so we can check if the click it still happens in DropDown or outside.

ethib137 commented 4 months ago

Thanks @matuzalemsteles! Do we have a sandbox example that we can reproduce the issue on? Have we been able to reproduce this outside of portal?

If we do have a sandbox example that can reproduce this issue, then we should also add that situation as a storybook sample so we can more easily test this in the future.

matuzalemsteles commented 4 months ago

Do we have a sandbox example that we can reproduce the issue on? Have we been able to reproduce this outside of portal?

I managed to reproduce it in the storybook using the same props that are defined in the Page Tree actions, I will create a sandbox to share.

If we do have a sandbox example that can reproduce this issue, then we should also add that situation as a storybook sample so we can more easily test this in the future.

Yeah, I'll create a new example to illustrate the portal case.

matuzalemsteles commented 4 months ago

I updated the storybook example by adding the case that reproduces this problem in Firefox, basically an item that is a link was causing the bug.

matuzalemsteles commented 4 months ago

I'm going to merge this so I can include it in today's release. If we need to make any further changes, we can make a new follow-up PR.