Skip to content

Add a 'filter' button next to the tooltip label of markers.#5626

Merged
canova merged 2 commits into
firefox-devtools:mainfrom
fqueze:filter-markers-from-tooltip
Oct 21, 2025
Merged

Add a 'filter' button next to the tooltip label of markers.#5626
canova merged 2 commits into
firefox-devtools:mainfrom
fqueze:filter-markers-from-tooltip

Conversation

@fqueze

@fqueze fqueze commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

This should be especially useful to quickly update the filter box based on the label of an interesting marker that has been selected.

Relevant example profile: https://share.firefox.dev/42kDTuf

image

The result after clicking the filter button: https://share.firefox.dev/4gQHPsx

@fqueze fqueze requested a review from mstange October 3, 2025 14:16
@codecov

codecov Bot commented Oct 3, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.87755% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.76%. Comparing base (f566a5b) to head (8e92259).

Files with missing lines Patch % Lines
src/profile-logic/marker-schema.tsx 91.89% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5626      +/-   ##
==========================================
+ Coverage   85.75%   85.76%   +0.01%     
==========================================
  Files         311      311              
  Lines       30703    30747      +44     
  Branches     8443     8455      +12     
==========================================
+ Hits        26329    26370      +41     
- Misses       3950     3953       +3     
  Partials      424      424              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@canova canova requested review from canova and removed request for mstange October 14, 2025 08:59

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR. Requesting changes for the place where we decide not to show the filter button for labels with a space in them. Please see my comment below.

Comment thread src/components/tooltip/Marker.tsx Outdated
const { className } = this.props;
const { className, markerIndex, getMarkerLabel } = this.props;
const markerLabel = getMarkerLabel(markerIndex);
const filterButtonTitle = `Only show "${markerLabel}" markers`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we also make this localized?

Comment thread src/components/tooltip/Marker.tsx Outdated
{this._maybeRenderMarkerDuration()}
<div className="tooltipTitle">{this._renderTitle()}</div>
<div className="tooltipTitle">
{markerLabel.includes(' ') ? (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we not print the filter button when there is a space? This looks arbitrary and will probably make our users confused.

Edit: I think you did it this way because the title might actually include other payload fields. But this seems very strange UX-wise because a single marker field/marker name might still include spaces. For example, we have markers that has "CSS Transition" in the name. So because of this check, we won't be able to filter that.

I think we should have a different solution instead. Instead of passing markerLabel to changeMarkersSearchString we can just pass the marker name instead. If you want to be able to still filter by not just marker names, but with other fields too. Then we should have a different approach of figuring out if the markerLabel contains multiple fields. One solution that comes to my mind is to extract all the fields from the markerLabel and then create a comma separated list from these, so we can still search by that specifically.

For example, while I was testing it locally, I had this marker: beforescriptexecute - DOMEvent, and the tooltipLabel schema field for that marker is "{marker.data.eventType} - DOMEvent". Instead we can just extact the marker.data.eventType from there and search for it. If a marker lable contains this "{marker.data.eventType} - {marker.data.name}, we can extact both and create a search string with "{marker.data.eventType},{marker.data.name} instead that can be searched properly with the logical AND.

This can be done in a selector level instead, for example we have getMarkerTooltipLabelGetter for the label getter. We can have another getter for the tooltip label search term.

Comment on lines +100 to +106
if (
prevProps.defaultValue !== this.props.defaultValue &&
this.props.defaultValue !== null
) {
this._previouslyNotifiedValue = this.props.defaultValue;
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, checking for defaultValue looks counter-intuitive here.

// think the value hasn't changed.
if (
prevProps.defaultValue !== this.props.defaultValue &&
this.props.defaultValue !== null

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, why do we check for this.props.defaultValue !== null here. What happens if this value gets updated from "something" to null.

@fqueze fqueze force-pushed the filter-markers-from-tooltip branch from 0c8cd2c to 35d8666 Compare October 16, 2025 16:50
@fqueze fqueze requested a review from a team as a code owner October 16, 2025 16:50
Comment thread locales/en-US/app.ftl Outdated
Comment on lines +501 to +502
.title = Only show "{ $markerName }" markers
.aria-label = Only show "{ $markerName }" markers

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually this is not really accurate. We are not showing only "$markerName markers. We are filtering every marker by that name.
I think it should be something like:

Only show markers matching: “{ $markerName }”

We have something similar here:

TransformNavigator--drop-samples-outside-of-markers-matching = Drop samples outside of markers matching: “{ $item }

@fqueze fqueze force-pushed the filter-markers-from-tooltip branch from 35d8666 to 8e92259 Compare October 21, 2025 11:51

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me with some nits, thanks!

Comment thread src/profile-logic/marker-schema.tsx Outdated
markerSchema: MarkerSchema,
stringTable: StringTable,
label: string
): string {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

let's return string | null here and return null in cases we return ''.

Comment on lines +444 to +446
if (keys.length !== 3) {
return '';
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess people can write marker.name at the start of the tooltip. But I guess that will be handled in the getSearchTermGetter if it's not found.

// Note: The `.` in the pattern matches bidi isolation characters that Fluent
// adds around variables for proper text directionality
const filterButton = screen.getByRole('button', {
name: /only show markers matching: “.Reflow.”/i,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We usually write the isolation characters specifically, for example:

'Only show “\u2068Parent Process\u2069”'

Comment thread src/components/tooltip/Marker.css Outdated
flex: none;
padding: 0;
border: none;
margin-left: 6px;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

let's use margin-inline-start

Comment thread src/components/tooltip/Marker.css Outdated
background-image: url(../../../res/img/svg/filter.svg);
background-position: center;
background-repeat: no-repeat;
background-size: 16px 16px;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is necessary.

@fqueze fqueze force-pushed the filter-markers-from-tooltip branch from 8e92259 to 68194b6 Compare October 21, 2025 12:48

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

@canova canova enabled auto-merge (squash) October 21, 2025 12:53
@canova canova merged commit 9d65777 into firefox-devtools:main Oct 21, 2025
12 of 13 checks passed
@canova canova mentioned this pull request Oct 21, 2025
canova added a commit that referenced this pull request Oct 21, 2025
Changes:

[Markus Stange] Streamline some code related to profile publishing
(#5608)
[Nazım Can Altınova] Implement fetching JS sources from browser via
WebChannel (#5506)
[Nisarg Jhaveri] Remove "Back to home" link on import errors when not
loading from file (#5279)
[Florian Quèze] Show the 'inl' badge on inlined frames showing in marker
stacks. (#5628)
[Florian Quèze] Add a 'filter' button next to the tooltip label of
markers. (#5626)


And thanks to our localizers:

de: Michael Köhler
el: Jim Spentzos
en-GB: Ian Neal
es-CL: ravmn
fr: brumedautomne127
fur: Fabio Tomat
fy-NL: Fjoerfoks
ia: Melo46
it: Francesco Lodolo [:flod]
nl: Mark Heijl
pt-BR: Marcelo Ghelman
ru: Valery Ledovskoy
sv-SE: Andreas Pettersson
tr: Grk, Selim Şumlu
zh-CN: Olvcpr423
zh-TW: Pin-guang Chen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants