Source code

Revision control

Copy as Markdown

Other Tools

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
.travel {
@include widget-base-style;
// The frame is full bleed: it fills the card edge to edge, and the badge and
// context menu float over it. Clipping rounds the frame's corners to the
// card's inner edge; the context menu opens as a popover, so it isn't
// clipped.
padding: 0;
overflow: hidden;
&.medium-widget {
grid-row: span 2;
}
&.large-widget {
grid-row: span 4;
}
}
// The card and the frame keep the title as their accessible name.
.travel .sr-only {
@include visually-hidden;
}
.travel-overlay {
position: absolute;
inset-block-start: 0;
inset-inline: 0;
display: flex;
align-items: flex-start;
padding: var(--space-small);
// Only the badge and menu take pointer events, so the frame stays usable
// between them.
pointer-events: none;
> * {
pointer-events: auto;
}
}
.travel-new-badge {
flex: none;
background-color: var(--badge-background-color-filled);
border-radius: var(--badge-border-radius);
text-transform: uppercase;
--badge-padding-block: 1px;
--badge-padding-inline: var(--space-small);
--badge-background-color-filled: var(--color-green-40);
--badge-text-color: var(--badge-text-color-filled);
--badge-border-color: transparent;
}
@media (forced-colors: active) {
.travel-new-badge {
--badge-background-color-filled: AccentColor;
}
}
.travel-context-menu-wrapper {
margin-inline-start: auto;
// A backdrop keeps the button readable over any frame content.
background-color: var(--newtab-background-color-secondary);
border-radius: var(--border-radius-medium);
// Hidden, and not a click target, until the card is hovered or focused.
opacity: 0;
pointer-events: none;
}
.travel:hover,
.travel:focus-within {
.travel-context-menu-wrapper {
opacity: 1;
pointer-events: auto;
}
}
.travel-frame {
flex: 1;
min-block-size: 0;
width: 100%;
border: none;
// Hidden until the widget's document sends widget_ready.
.travel:not([data-ready]) & {
visibility: hidden;
}
}