Skip to content

devex: Replace inverted tooltip style with popver component #2644

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

Merged
merged 6 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions frontend/src/components/ui/popover.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { localized } from "@lit/localize";
import SlTooltip from "@shoelace-style/shoelace/dist/components/tooltip/tooltip.component.js";
import slTooltipStyles from "@shoelace-style/shoelace/dist/components/tooltip/tooltip.styles.js";
import { css } from "lit";
Expand All @@ -19,7 +18,6 @@ import { customElement, property } from "lit/decorators.js";
* @attr {Boolean} disabled
*/
@customElement("btrix-popover")
@localized()
export class Popover extends SlTooltip {
@property({ type: Boolean, reflect: true })
hoist = true;
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/ui/table/table.stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ btrix-table-cell .rowClickTarget {
max-width: 100%;
}

btrix-table-cell sl-tooltip > * {
btrix-table-cell sl-tooltip > *,
btrix-table-cell btrix-popover > * {
/* Place above .rowClickTarget::after overlay */
z-index: 1;
}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/features/qa/page-list/ui/page-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function formatPercentage(n: number, fractionDigits = 2) {

export const pageDetails = (page: ArchivedItemQAPage) =>
html`<ul class="leading-4">
<li class="my-3 flex">
<li class="flex">
${iconFor(
severityFromMatch(page.qa.screenshotMatch),
tw`mr-2 flex-none`,
Expand Down Expand Up @@ -65,7 +65,7 @@ export const pageDetails = (page: ArchivedItemQAPage) =>
: msg("No Crawl Diff")}
</span>
</li>
<li class="my-3 flex">
<li class="flex">
${iconFor(
severityFromResourceCounts(
page.qa.resourceCounts?.replayBad,
Expand Down Expand Up @@ -93,7 +93,7 @@ export const pageDetails = (page: ArchivedItemQAPage) =>
<div class="my-2 text-xs text-neutral-400">
${msg("Newest comment:")}
</div>
<div class="mb-3 flex text-xs leading-4">
<div class="flex text-xs leading-4">
<sl-icon
name="chat-square-text-fill"
class="mr-2 size-4 flex-none text-blue-600"
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/features/qa/page-list/ui/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class QaPage extends TailwindElement {
tabindex="0"
aria-selected=${this.selected}
>
<sl-tooltip class="invert-tooltip" placement="left" hoist>
<btrix-popover placement="left">
<div slot="content" class="max-w-60 text-xs">
${pageDetails(page)}
</div>
Expand Down Expand Up @@ -174,7 +174,7 @@ export class QaPage extends TailwindElement {
class="text-blue-600"
></sl-icon>`}
</div>
</sl-tooltip>
</btrix-popover>
<h5 class="truncate text-sm font-semibold text-black">
${page.title ||
html`<span class="opacity-50">${msg("No page title")}</span>`}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/org/archived-item-detail/ui/qa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,12 +797,12 @@ export class ArchivedItemDetailQA extends BtrixElement {
<btrix-table-cell>
${page.notes?.length
? html`
<sl-tooltip class="invert-tooltip">
<btrix-popover>
<div slot="content">
<div class="text-xs text-neutral-400">
<div class="mb-1 text-xs text-neutral-400">
${msg("Newest comment:")}
</div>
<div class="leading04 max-w-60 text-xs">
<div class="max-w-60 text-xs leading-4">
${page.notes[page.notes.length - 1].text}
</div>
</div>
Expand All @@ -813,7 +813,7 @@ export class ArchivedItemDetailQA extends BtrixElement {
></sl-icon>`,
`${this.localize.number(page.notes.length)} ${pluralOf("comments", page.notes.length)}`,
)}
</sl-tooltip>
</btrix-popover>
`
: html`<span class="text-neutral-400">
${msg("None")}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/org/browser-profiles-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ export class BrowserProfilesList extends BtrixElement {
<btrix-table-cell>
<div class="truncate">${data.origins[0]}</div>
${data.origins.length > 1
? html`<sl-tooltip class="invert-tooltip">
<span slot="content" class=" break-words"
? html`<btrix-popover placement="top">
<span slot="content" class="break-words"
>${data.origins.slice(1).join(", ")}</span
>
<btrix-badge class="ml-2">
${msg(str`+${data.origins.length - 1}`)}
</btrix-badge>
</sl-tooltip>`
</btrix-popover>`
: nothing}
</btrix-table-cell>
<btrix-table-cell class="whitespace-nowrap tabular-nums">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/stories/components/Popover.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const TopPlacement: Story = {
args: {
open: true,
placement: "top",
anchor: html`<btrix-badge>Popover displays below</btrix-badge>`,
anchor: html`<btrix-badge>Popover displays above</btrix-badge>`,
},
};

Expand Down
13 changes: 0 additions & 13 deletions frontend/src/theme.stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -263,19 +263,6 @@
min-width: min-content;
}

/* Style tooltip with white background */
/* TODO Replace instances with `<btrix-popover>` */
sl-tooltip.invert-tooltip {
--sl-tooltip-arrow-size: 0;
--sl-tooltip-background-color: var(--sl-color-neutral-50);
--sl-tooltip-color: var(--sl-color-neutral-700);
}

sl-tooltip.invert-tooltip::part(body) {
outline: 1px solid var(--sl-panel-border-color);
box-shadow: var(--sl-shadow-large);
}

sl-tab-group {
--indicator-color: var(--sl-color-primary-500);
}
Expand Down
Loading