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

[Dropdown] Search with remote content causes Firefox to hang #2971

Closed
gdembowski opened this issue Jan 6, 2024 · 17 comments
Closed

[Dropdown] Search with remote content causes Firefox to hang #2971

gdembowski opened this issue Jan 6, 2024 · 17 comments
Labels
browser/firefox Any issues relating to Mozilla Firefox state/wont-fix Anything which isn't going to be fixed

Comments

@gdembowski
Copy link

Bug Report

I have noticed strange behaviour in the Firefox browser version 121 and higher. The browser hangs when searching remote from API. Strangely enough, not all sources are causing the problem.

Steps to reproduce

It can be reproduced on the current docs

  1. Open Firefox
  2. Go to: https://fomantic-ui.com/modules/dropdown.html#sanitized-version
  3. Start typing in "Sanitized Version" dropdown

Expected result

I expect the list to be filtered.

Actual result

The page is actually frozen under Firefox and surprisingly this filtering doesn't work in other browsers.
On the other hand the other examples with remote content works fine, e.g.: https://fomantic-ui.com/modules/dropdown.html#match-search-query-on-server

Testcase

https://fomantic-ui.com/modules/dropdown.html#sanitized-version

Screenshot (if possible)

Screenshot 2024-01-06 at 11 24 28
Screenshot 2024-01-06 at 11 28 09

Version

Fomantic ver 2.9.3
Firefox 121

@gdembowski gdembowski added state/awaiting-investigation Anything which needs more investigation state/awaiting-triage Any issues or pull requests which haven't yet been triaged type/bug Any issue which is a bug or PR which fixes a bug labels Jan 6, 2024
@lubber-de lubber-de added browser/firefox Any issues relating to Mozilla Firefox and removed state/awaiting-triage Any issues or pull requests which haven't yet been triaged labels Jan 6, 2024
@lubber-de
Copy link
Member

lubber-de commented Jan 6, 2024

The filtering does not work in that example as the "backend"-response is nothing else but a static JSON Value and wont be filtered at all. (This example just wants to show the preserveHTML setting difference)

However, at the moment i cannot tell why Firefox 121.x+ freezes. I suspect a browser bug. Need to investigate

@gdembowski gdembowski changed the title [Dropdown] Search hangs Firefox and ignored in other browsers [Dropdown] Search with remote content causes Firefox to hang Jan 7, 2024
@gdembowski
Copy link
Author

Thanks @lubber-de for the clarification. Indeed, the freezing Firefox is the main problem. I just panicked a bit and thought the lack of filtering is a related issue, but you're right, that's not the case with the static JSON example.

I did another investigation and it seems the number of records returned by the API matters.
Here are the examples:

  1. Static content 333 records: no freezing - https://jsfiddle.net/t028c5L7/1/
  2. API content 329 records: freezing for a long time - https://jsfiddle.net/5kvwe47o/
  3. API content 158 records: short freezing - https://jsfiddle.net/b5yc48g7/1/
  4. API content 67 records: unnoticeable, small delay in typing - https://jsfiddle.net/02jorq79/1/

@slachinger
Copy link

slachinger commented Jan 8, 2024

I'm using Fomantic-UI css in conjunction with semantic-ui-react and experience the issue with static content (300 records) too.

An example using the latest fomantic-ui/2.9.3/semantic.min.css can be found here: https://jsfiddle.net/7mk4s6u0/5/ - using Firefox, when starting to type "Computer" in the input field, the tab freezes.

I tested downgrading to previous versions and found that it started working fine using fomantic-ui/2.9.1/semantic.min.css : https://jsfiddle.net/zowf18k6/

Hence, I assume the issue was introduced in 2.9.2. Downgrading to 2.9.1 fixed the issue for me. Hope this helps.

@prudho
Copy link
Contributor

prudho commented Jan 9, 2024

@slachinger indeed, it helps !

Looks like it's a CSS issue with Firefox 121.x+, but i cannot figure what's happening here.

In dist/fomantic.css L43527, just comment this lines:

@supports selector(:has(.f)) {
  *:has(> .ui.piled.segment) {
    z-index: 0;
    position: relative;
  }
}

And freezes are gone !

@lubber-de I suspect this to be the culprit, but why it's driving Firefox nuts is out of my knowledge !

@lubber-de
Copy link
Member

lubber-de commented Jan 9, 2024

Thanks for finding the reason @prudho !
Well, Firefox just supported :has since 121 which is obviously implemented ineffectively in firefox which causes the freeze so mozilla has to fix this in general.

What one can do right now:

  • set @variationSegmentPiled: false and rebuild FUI which will remove the piled segment variant

What we can change in the core is either

  • adjust the @supports selector for the moment so it won't affect firefox (especially since 121 where :has support is enabled by default)
- @supports selector(:has(.f)) {
+ @supports selector(:has(.f)) and (not(-moz-appearance: none)) {

This could be removed again once it is fixed in firefox

  • make the *:has selector more specific, so it won't affect dropdown (infact a piled segment will most probably never be inside a dropdown), but this drastically limits the usage, as one has to declare a possible piled segment to a prepared parent element (and i dont imagine what we should define here, that was the reason back then to use the star selector)
    However, i haven't yet tested if this will fix it at all in firefox as it seems the firefox css engine will check the selector on each DOM change, so this probably doesnt help at all.
  • Partly revert fix(segment): piled segments under parent background, inverted variants #2730 and remove the whole selector (which i dont think we should do as other browsers support this just fine without a performance lag)

What do you guys prefer? ( i vote for the first option to advance the @supports selector

@prudho
Copy link
Contributor

prudho commented Jan 10, 2024

I choose first option too. It's quick and just disable a buggy behavior without breaking anything else.

@lubber-de
Copy link
Member

mmh, i cannot get this to reprocuce locally or via a jsfiddle and not even by trying the docs locally. Firefox works just fine.
ONLY the online docs freeze.
Even worse, i tried to manipulate the css inside the online docs as discussed above and it still freezes.
I also tried to make the :has selector more specific (even by using a non existing selector) ...and it still freezes.

@prudho Have you got a reproducable jsfiddle or how did you confirm removing the @supports selector worked for the online docs?

https://jsfiddle.net/lubber/etpjsrxo/6/

@lubber-de
Copy link
Member

Here a comparison between local docs yarn docpad run -> no freeze
and fomantic-ui.com -> freeze, although the docs are the same code

firefoxfreezeonline

@lubber-de
Copy link
Member

lubber-de commented Jan 10, 2024

Here is my try to change the supports-selector as discussed above (i added a red background to find out if the additional rule will not affect firefox)...it still freezes although the selector is not even executed.

So, even if we add my suggested change "dry" to the core, i suspect the issue still exists.

firefoxfreezeonlineselectorchange

@lubber-de lubber-de added the tag/help-wanted Issues which need help to fix or implement label Jan 10, 2024
@lubber-de
Copy link
Member

And, even weird....last try: I removed the whole selector...firefox still freezes

@prudho Please help if/where/how you confirmed it is fixed when removing the selector
firefoxfreezeonlineselectorremove

@lubber-de
Copy link
Member

lubber-de commented Jan 10, 2024

@slachinger @prudho
🤔 I took the working example using 2.9.1 and added the @supports selector.

https://jsfiddle.net/e70xjovw/1/

I would have expected firefox to freeze now.... but it doesnt (which would explain, why my previous teste also did not make any difference

So the reason for the freeze must be somewhere else

@lubber-de
Copy link
Member

lubber-de commented Jan 10, 2024

I got it. 💪🏼 It's a combination of 3 specific @supports selector(:has) selectors , so :has is still broken in certain scenarios in firefox. All the other supports selector(:has) selectors which are also new in 2.9.3 did not affect the issue.

Using 2.9.2 and adding the 3 selectors in question will freeze firefox reproducable.
https://jsfiddle.net/e70xjovw/8/

adjusting the selector to ignore firefox will fix it in firefox
https://jsfiddle.net/e70xjovw/9/

However: keep in mind that the selectors in question do not even belong to the example code! There is no piled segment and no pointing dropdown so the selector will not even trigger. (and i also tested to make the *:has more specific: It does not matter. Something in firefox makes the parsing of those three internally freeze....

I can confirm the change (of all 3 selectors) also fixes the docs page

Will prepare a PR :)

@lubber-de
Copy link
Member

Fixed by #2973

@lubber-de
Copy link
Member

I filed an issue for mozilla at webcompat/web-bugs#132131

@lubber-de lubber-de added state/has-pr An issue which has a related PR open and removed tag/help-wanted Issues which need help to fix or implement state/awaiting-investigation Anything which needs more investigation labels Jan 10, 2024
@lubber-de lubber-de added this to the 2.9.4 milestone Jan 10, 2024
@lubber-de
Copy link
Member

mozilla confirmed the issue and takes care about that by https://bugzilla.mozilla.org/show_bug.cgi?id=1874066

@lubber-de
Copy link
Member

I can confirm, the issue is fixed in latest firefox 123.a01
https://archive.mozilla.org/pub/firefox/nightly/2024/01/2024-01-20-09-39-31-mozilla-central/

@lubber-de
Copy link
Member

Firefox 123 was released today and fixed the issue. Please update your browser

@lubber-de lubber-de added state/wont-fix Anything which isn't going to be fixed and removed type/bug Any issue which is a bug or PR which fixes a bug state/has-pr An issue which has a related PR open labels Feb 20, 2024
@lubber-de lubber-de removed this from the 2.9.4 milestone Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser/firefox Any issues relating to Mozilla Firefox state/wont-fix Anything which isn't going to be fixed
Projects
None yet
Development

No branches or pull requests

4 participants