fix: add fallback selector for the content gate in block theme#4431
Open
laurelfulford wants to merge 1 commit intotrunkfrom
Open
fix: add fallback selector for the content gate in block theme#4431laurelfulford wants to merge 1 commit intotrunkfrom
laurelfulford wants to merge 1 commit intotrunkfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Both styles of content gate seem to work well out of the box with the block theme. So far, the only thing I've noticed is missing is some kind of fallback for the
entryselector.The Post Content block (part of the Query Block) also uses
.entry-contentas a CSS class, so the main selector is available.The
#contentID that's used as a fallback isn't part of the block theme. Instead of trying to add it, I added a second fallback using#wp--skip-link--target, which is added to the<main>element by some JS in WordPress, at roughly the same level as#content.See NPPD-1126
How to test the changes in this Pull Request:
npm run build.let entrydefinition, to make sure it doesn't match any CSS classes, so the fallback will need to be used (eg.let entry = document.querySelector( '.entry-content-not-a-real-class' );npm run build, and retest the gate in the incognito window. The skip link ID is fairly high so the gate will trigger before scolling, but this is also the case with the Classic theme and#content(it contains the post header, whereas.entry-contentonly contains the post body).Other information: