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

Rearrange useraction group to match focus-within before focus #74

Closed
wants to merge 1 commit into from

Conversation

theKashey
Copy link

@theKashey theKashey commented Jan 31, 2023

Currently a style with :focus-within ends as :focus + -within generating incorrect rule

The code before was producing for something like

.class1:focus-within .class2

something like

(function anonymous(s) {
"use strict";return function Resolver(c,f,x,r){var e,n,o;e=c;if((e.nodeName.toLowerCase()=="focus")){if((e===s.doc.activeElement&&s.doc.hasFocus()&&(e.type||e.href||typeof e.tabIndex=="number"))){if((/(^|\s)eGeHBG(\s|$)/.test(e.getAttribute("class")))){r=true;}}}return r;}
})

Where e.nodeName.toLowerCase()=="focus" is definitely not what expected

Currently a style with `:focus-within` ends as `:focus` + `-within` generating incorrect rule
@dospunk
Copy link

dospunk commented Mar 7, 2023

I'd love to see this pulled soon! This issue has had me struggling for a few days

@dperini
Copy link
Owner

dperini commented Mar 13, 2023

@theKashey
I will first check if hooking the RegExp to start "^" and to the end "$" could solve the problem.
In the case this doesn't work I will bend to the above alternative, thus rearranging the checking order.

@theKashey
Copy link
Author

According to stack overflow ^ will enforce longest-match, so please try

@theKashey
Copy link
Author

Solved by 8834c5e

@theKashey theKashey closed this Mar 28, 2023
@theKashey
Copy link
Author

The original fix was reverted due to #80
From my own experiments, changing order is enough to greatly improve behaviour without capability of introducing loops.

@theKashey theKashey reopened this Jun 27, 2023
@dospunk
Copy link

dospunk commented Jul 24, 2023

Any chance this can be reevaluated? Would love to see this bug fixed!

@dperini
Copy link
Owner

dperini commented Aug 4, 2023

@dospunk
Sure ... I am all for it. I thought this was fixed with the reordering of the user actions pseudo-class strings..
Can you please help and update me with a failing ":focus-within" test case that I can start with ?

@dospunk
Copy link

dospunk commented Aug 4, 2023

@dperini My bad, it does seem to be working now!

@KatWorkGit
Copy link

If there are comments about this working, should this issue be closed? I stumbled upon it from jsdom/jsdom#3359

@theKashey
Copy link
Author

The order is now correct. Not sure why this PR has't been marked as conflicted.

@theKashey theKashey closed this Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants