Skip to content

[Discover] recently closed tabs preview#246973

Merged
drewdaemon merged 27 commits intoelastic:mainfrom
drewdaemon:244863/recently-closed-tabs-preview
Jan 14, 2026
Merged

[Discover] recently closed tabs preview#246973
drewdaemon merged 27 commits intoelastic:mainfrom
drewdaemon:244863/recently-closed-tabs-preview

Conversation

@drewdaemon
Copy link
Contributor

@drewdaemon drewdaemon commented Dec 18, 2025

Summary

fix #244863

Screenshot 2026-01-12 at 1 33 36 PM

Checklist

  • Update storybook / example
  • Unit or functional tests were updated or added to match the most common scenarios
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

Release note:

Improves the recently closed tabs menu in Discover. On hover, you now see a preview of what was contained in each closed tab.

}

export type RecentlyClosedTabItem = TabItem & {
closedAt: number;
Copy link
Contributor Author

@drewdaemon drewdaemon Dec 19, 2025

Choose a reason for hiding this comment

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

This makes the dependency on closedAt more explicit. Previously, it was a shadow property that was being used but not disclosed in the unified tabs package interfaces.


interface OptionData {
closedAt?: moment.Moment;
tabItem: RecentlyClosedTabItem;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added so that it can be passed to getPreviewData

@drewdaemon drewdaemon added release_note:enhancement Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// backport:version Backport to applied version labels v9.4.0 labels Dec 19, 2025
}
tabItem={{ id: option.key as string, label: option.label }}
previewData={previewData}
previewDelay={0}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note this difference with the tab header previews. No delay felt better to me, but I'm not sure about it.

@drewdaemon
Copy link
Contributor Author

drewdaemon commented Dec 20, 2025 via email

@drewdaemon
Copy link
Contributor Author

drewdaemon commented Dec 20, 2025 via email

@drewdaemon
Copy link
Contributor Author

drewdaemon commented Dec 20, 2025 via email

@drewdaemon
Copy link
Contributor Author

drewdaemon commented Dec 21, 2025 via email

@drewdaemon drewdaemon marked this pull request as ready for review January 5, 2026 18:01
@drewdaemon drewdaemon requested a review from a team as a code owner January 5, 2026 18:01
@elasticmachine
Copy link
Contributor

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

@davismcphee
Copy link
Contributor

Assigning @jughosta for code review, but we should also get design approval from @l-suarez before merging.

Copy link
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

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

Looks great, Drew! I like having the preview for closed tabs now 🎉
We could also enable it for "Opened tabs" list in the same popover, right?

) => {
const tabRuntimeState = selectTabRuntimeState(runtimeStateManager, tabState.id);

if (!tabRuntimeState) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!tabRuntimeState) {
if (tabState.closedAt) {

The normal tabs which are not visited yet also don't have a runtime state (after a page refresh for example).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in d730ca2

Comment on lines 125 to 133
<>
{option.label}
{formattedTime && (
<EuiText size="xs" color="subdued" className="eui-displayBlock">
{formattedTime}
</EuiText>
)}
</>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

This part can be a reusable variable too, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 3a5dd80

return tabItems.map((tab) => {
const closedAt = 'closedAt' in tab && tab.closedAt ? moment(tab.closedAt) : undefined;
const option = {
const momentClosedAt = moment(tab.closedAt);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the items get rerendered when the mouse cursor moves, the time updates too. Wdyt about this side effect?

Image

Copy link
Contributor Author

@drewdaemon drewdaemon Jan 8, 2026

Choose a reason for hiding this comment

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

I think it's weird 😁 (will look into it)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 56237e6

Screen.Recording.2026-01-08.at.4.11.07.PM.mov

Comment on lines 56 to 58
title: `${tab.label}${
momentClosedAt.isValid() ? ` (${momentClosedAt.format('LL LT')})` : ''
}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
title: `${tab.label}${
momentClosedAt.isValid() ? ` (${momentClosedAt.format('LL LT')})` : ''
}`,

The preview is sufficient I think, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 76bf83f

@drewdaemon
Copy link
Contributor Author

We could also enable it for "Opened tabs" list in the same popover, right?

Good idea 3a5dd80

Copy link
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! 👍

Can we address the React warnings?

Copy link
Contributor

Choose a reason for hiding this comment

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

There are a couple of warnings when opening the menu popover:

Warning: React does not recognize the `tabItem` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `tabitem` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
Warning: React does not recognize the `formattedTime` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `formattedtime` instead. If you accidentally passed it from a parent component, remove it from the DOM element.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hopefully. They may be created on the EUI side. Will take a look!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@davismcphee
Copy link
Contributor

@drewdaemon Just a heads up that I pinged @l-suarez in Slack to do a design review on this after the weekend.

@drewdaemon
Copy link
Contributor Author

drewdaemon commented Jan 9, 2026

sounds good davis, we will make it pretty before I merge 😁

@l-suarez
Copy link
Contributor

Hello! Thanks for adding this to the tabs menu, super useful to see the query/dataview behind the tabs name. I created an instance in a la carte in case you need it: https://l-suarez-pr-246973-244863-recently-closed-tabs-preview.kbndev.co/

Ok, we had this issue with the tabs themselves when we were implementing them, the browsers default behaviour of opening a tooltip is not needed (we cover that use case with our own tabs preview), could we disable its appearance? Also, this is probably the components behaviour, but we don't display long names properly on the list. Truncation will be a nice to have here.
image

In terms of alignment, could we align the preview like this so it doesn't overlap with the menu?
image

That's all from me, looking great!

@l-suarez
Copy link
Contributor

Thinking about this work, it would be great if we can use the same pattern (showing query/dataview behind the tab on hover when the name is present) in other places, such as the dashboard panel list? I don't know how we're solving that particular work, but I thought this pattern would be nice to be reused somewhere else, and treat it as it is part of the Discover tab component pattern, wdyt @davismcphee @drewdaemon @jughosta?

@drewdaemon
Copy link
Contributor Author

@l-suarez totally I'll look into the browser tooltip and the alignment. I also had the same thought about having this preview on the list when choosing a tab for the dashboard. Would have to think a bit about the technical side of that though because it's currently pretty coupled to the discover view.

@drewdaemon
Copy link
Contributor Author

@elasticmachine merge upstream

@davismcphee
Copy link
Contributor

Thanks for the review @l-suarez! Regarding using the preview in the dashboard list too, it sounds reasonable to me, but I'm also unsure of the technical effort at a glance. We could include it in the designs though and investigate it as part of that project.

@drewdaemon Thanks for the updates. I didn't do a formal review, but gave it a quick spin and the alignment looks much nicer! Just a heads up about a couple of things:

  • I'm still seeing the native browser tooltip when hovering a list item (maybe you just didn't get to it yet).
  • It looks like the truncation issue is related to wrapping the list item text in divs / block level elements here and here. If we switch those to spans or anything inline (can probably remove the first entirely), it should fix the truncation.

@drewdaemon
Copy link
Contributor Author

drewdaemon commented Jan 12, 2026

Davis — I haven't yet taken care of the design feedback. If you're hoping to review the design updates before this merges I can give you a ping when they're done!

Barring an EUI change, we may be stuck with the native tooltip. It is EUI which is applying that title tag to the li. Waiting on feedback from that team.

I appreciate you pointing out the connection between the divs and the truncation. I added the first div you linked because with a span, the hover area for the preview popover is incomplete and buggy. So, I'll have to find a win-win.

@drewdaemon
Copy link
Contributor Author

@elasticmachine merge upstream

@drewdaemon
Copy link
Contributor Author

Ok, design feedback is addressed!

@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 13, 2026

⏳ Build in-progress, with failures

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #2 / form validations settings (step 2) should validate required repository settings
  • [job] [logs] Jest Tests #2 / form validations settings (step 2) should validate required repository settings
  • [job] [logs] Jest Tests #2 / ChangePasswordModal render when rendered for current user disables submit button when passwords do not match
  • [job] [logs] FTR Configs #3 / Cloud Security Posture POST /internal/cloud_security_posture/graph Happy flows Enrich graph with entity metadata should contain entity data when asset inventory is enabled
  • [job] [logs] FTR Configs #55 / Fleet Endpoints Settings Endpoints Global Settings should reindex knowledge base when setting is enabled
  • [job] [logs] Jest Tests #2 / TabsBarMenu marks the selected tab as checked
  • [job] [logs] Jest Tests #2 / TabsBarMenu marks the selected tab as checked

History

@drewdaemon drewdaemon merged commit 358b39f into elastic:main Jan 14, 2026
14 checks passed
@kibanamachine kibanamachine added backport:skip This PR does not require backporting and removed backport:version Backport to applied version labels labels Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:enhancement Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discover][Unified Tabs] Add preview to Recently closed Tabs

6 participants

Comments