-
Notifications
You must be signed in to change notification settings - Fork 35
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
WIP: Rewrite LiveSearch as an ES Module #5370
Open
kr8n3r
wants to merge
6
commits into
main
Choose a base branch
from
rewrite-livesearch-as-esm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+169
−125
Conversation
This file contains 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
7dd9ab3
to
ed0bb95
Compare
rename and adapt to ES Module
ed0bb95
to
b2bd12f
Compare
tombye
requested changes
Feb 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I spotted a few things, one a bit pedantic and the other more of a question. Everything else great though 👍🏻
We want to migrate all of our legacy Javascript files to ESM, so this is the latest in the series of conversions. Rewrite follows the same conventions we previously used for FocusBanner, Collapsible checkboxes, ColourPreview, FileUpload, Autofocus, PreviewPane and CopyToClipboard. Added bonus: removes the use of jQuery as well
4b165ad
to
c036ea6
Compare
spotted an issue with template search :( |
We use hidden attribute to hide items that don't match live-search results. Normally, the broser would hide the element, but as these ones have the display property set, we need to set additional override styles.
There are some items that are hidden by default with CSS and which we need to show if they match the search query. Whiel we do the visibility toggling by applying the `hidden` attribute to the each item, we cannot use the same attribute of the hiden-by-default items, as the checkbox macro from DS does not accomodate for that, hence they're hidden by css class. This adds a bit more logic to the JS to apply a new class to those items when they match the search query and use CSS to show them, as well as remove the same class when they don't match or the search query is empty (default state)
When they match the search query
c036ea6
to
8966f33
Compare
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.
We want to migrate all of our legacy Javascript files to ESM, so this is the latest in the series
of conversions.
Rewrite follows the same conventions we previously used for FocusBanner, Collapsible checkboxes,
ColourPreview, FileUpload, Autofocus, PreviewPane and CopyToClipboard.
Added bonus: removes the use of jQuery.
In this PR we:
How to test