User tests: Successful: Unsuccessful:
Pull Request resolves # .
Adds a configurable CSS selector to the System - Highlight plugin.
When a selector is configured, search terms are highlighted within the first element matching that selector. The plugin no longer wraps the component buffer in the a .js-highlight div, allowing templates to control the highlighting scope without introducing an extra wrapper element.
The existing .js-highlight wrapper behaviour remains unchanged when no selector is configured. Invalid selectors are handled with a browser-console warning.
<div class="js-highlight">.The System - Highlight plugin always wraps the complete component buffer in a <div class="js-highlight"> element. Templates cannot choose a more specific highlighting target or avoid this additional wrapper.
Administrators can configure a CSS selector to define the element in which search terms are highlighted. With a selector configured, the component buffer remains unmodified. Leaving the option empty preserves the existing .js-highlight wrapper behaviour.
Please select:
Documentation link for guide.joomla.org: TODO
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org: TODO
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Administration Language & Strings JavaScript NPM Change Front End Plugins |
Currently the Highlight plugin always wraps the output in a <div class="js-highlight"> element.
Not only on the search results page but also on the single article views and the rendered markup changes when the url is opened with the &highlight= parameter.
With this PR there is an option to specify a selector the highlight.js script will work with. Similar to the jooa11y plugin where you also can configure a selector.
Yes it wraps the entire output in a div with js-highlight but it does nothing. The styling of the highlight is just the css I showed and disabling that plugin doesnt have any impact on the search highlighting
Yes it wraps the entire output in a div with js-highlight but it does nothing. The styling of the highlight is just the css I showed and disabling that plugin doesnt have any impact on the search highlighting I see now that the plugin is required for highlighting on the subsequent individual article
Yes it wraps the entire output in a div with js-highlight but it does nothing. The styling of the highlight is just the css I showed and disabling that plugin doesnt have any impact on the search highlighting I see now that the plugin is required for highlighting on the subsequent individual article
I still dont see the reason for the changes in this PR. What am I missing?
Yes it wraps the entire output in a div with js-highlight but it does nothing on the results page. The styling of the highlight is just the css I showed and disabling that plugin doesnt have any impact on the search highlighting I see now that the plugin is required for highlighting on the subsequent individual article
I still dont see the reason for the changes in this PR. What am I missing?
| Labels |
Added:
Feature
Language Change
NPM Resource Changed
PR-6.3-dev
|
||
The language strings are now alpha sorted.
Only document.querySelectorAll(selector)is wrapped in try/catch, so the “invalid selector” warning cannot mask an unrelated error.
A warning is only shown for a syntactically wrong selector.
The motivation behind this is that having a hard-coded wrapper div could eventually cause these issues:
The language strings are now alpha sorted.
Only document.querySelectorAll(selector) is now wrapped in try/catch, so the “invalid selector” warning cannot mask an unrelated error.
A warning is only shown for a syntactically wrong selector.
The motivation behind this is that having a hard-coded wrapper div could eventually cause some issues.
It could break direct child CSS rules: grid children, flex children, > * selectors, spacing utilities, and component-specific selectors.
The plugin hard-codes both its implementation detail (js-highlight) and the markup strategy. Templates have no supported opt-out or selector override.
| Title |
|
||||||
I am confused with what you are trying to do here. A template can already change the markup of a search term when it is highlighted