fix: Implement alternative highlighting scheme for search #2556
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.
Change-Id: Ifcee0a5a30374b0d1e72a24c6c6d538dba16e58f
The basics
The details
Resolves
As discussed at the Blockly Summit, the highlighting behavior of the workspace-search plugin could be improved. This is one attempt at that. It might be worth further tweaking of the CSS attributes.
Proposed Changes
This PR updates the workspace search plugin to desaturate non-matching blocks while supersaturating the selected block to draw more focus to the selection rather than turning the actively highlighted block black. The currently focused block gets saturation +50%, other matching blocks get saturation -50%, and non-matching blocks are completely desaturated.
Reason for Changes
Test Coverage
Because changing the coloring logic needed to move the CSS classes around, I updated the test logic for detecting whether a block is actively in the search set.
Documentation
For developers looking to change the behavior, we may want to document how they override the CSS rules defined in plugins/workspace-search/src/css.ts. Anyone overriding the existing CSS rules will need to update their definitions.
Additional Information