Skip to content

[Discover][A11y] Add underline to search result highlights #228086

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

akowalska622
Copy link
Contributor

@akowalska622 akowalska622 commented Jul 15, 2025

Summary

Closes #214592

This PR adds text-decoration: dotted underline to search result highlights due to accessibility reasons.

Screenshot 2025-07-15 at 21 08 59 Screenshot 2025-07-15 at 21 07 50

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

Identify risks

Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.

@akowalska622 akowalska622 self-assigned this Jul 15, 2025
@akowalska622 akowalska622 changed the title add underline to highlighted values of the table [Discover][A11y] Add underline to search result highlights Jul 15, 2025
@akowalska622 akowalska622 added bug Fixes for quality problems that affect the customer experience Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins. Project:Accessibility WCAG A impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. defect-level-1 Critical UX disruption platform-accessibility Use to identify Platform a11y issues. Do not remove when an area team is assigned. labels Jul 15, 2025
@akowalska622 akowalska622 marked this pull request as ready for review July 16, 2025 08:02
@akowalska622 akowalska622 requested review from a team as code owners July 16, 2025 08:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-accessibility (Project:Accessibility)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@akowalska622 akowalska622 added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting labels Jul 16, 2025
@akowalska622 akowalska622 requested a review from a team as a code owner July 17, 2025 06:57
@akowalska622 akowalska622 added backport:version Backport to applied version labels v9.1.0 v8.19.0 and removed backport:skip This commit does not require backporting labels Jul 17, 2025
@akowalska622 akowalska622 requested a review from davismcphee July 17, 2025 09:18
Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good overall!

Unfortunately no good deed goes unpunished in Kibana, and this causes a weird issue in the summary columns for o11y profiles where the badge values disappear 🫠

highlight.mp4

Luckily I had an idea of why this was happening since I knew they were doing some fancy stuff with highlights to support those badges... Looks like we probably just need to update some regex here to account for attributes on mark tags. I'd recommend trying to make it generic, i.e. ignore any attributes, to protect against any similar changes in the future:

function extractTextAndMarkTags(html: string) {
const markTags: string[] = [];
const cleanText = html.replace(/<\/?mark>/g, (match) => {
markTags.push(match);
return '';
});
return { cleanText, markTags };
}

@akowalska622
Copy link
Contributor Author

@davismcphee wow, thank you! This shows how important is a review from someone more experienced with the product, I wouldn't even know it can break like this

@akowalska622 akowalska622 requested a review from a team as a code owner July 18, 2025 14:49
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New regex matches any additional props added to mark tag, before closing >.
It fixes a bug which was introduced with a new styling class added to mark - current regex was incorrectly recognizing tags and clean text

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 1.1MB 1.1MB +5.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 475.4KB 475.4KB +55.0B
fieldFormats 57.4KB 57.4KB +28.0B
total +83.0B

History

cc @akowalska622

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! Works great with the latest changes, and I confirmed the issue with the summary badges is now resolved 👍

Copy link
Contributor

@eokoneyo eokoneyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared UX LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels bug Fixes for quality problems that affect the customer experience defect-level-1 Critical UX disruption impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. platform-accessibility Use to identify Platform a11y issues. Do not remove when an area team is assigned. Project:Accessibility release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins. v8.19.0 v9.1.0 WCAG A
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Accessibility) Search Result only highlighted by color
4 participants