Vue kit: UiCloseButton for every close button in the views

UiCloseButton is a UiButton with a fixed glyph (× or the Material close
symbol through UiIcon), a required accessible label and no tip unless the
site passes a title. Attributes and classes pass through, so each site keeps
its id, feature class, data and aria attributes, and its look.

Its kit class, ui-close-button (close-button.css, loaded before the feature
stylesheets), is Core's common look: a bare glyph with no padding, border
or background of its own, and a pointer. The guide's close button shares
the rule, and the copies of those declarations leave the feature rules.
`bare` leaves the look off for Street Level's and the space mission's close
buttons, whose skins keep the browser's padding. UiIcon takes size null to
leave the glyph's size to the stylesheet.

The sixteen hand-written close, dismiss and clear buttons in the SFCs are
now UiCloseButtons; closeButtons.test.mjs pins that none remain.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-19 00:19:33 -08:00
1 parent c58f9fbdc6
commit 1711b4b456
32 files changed
+317 -69

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
<script setup>
import UiButton from './UiButton.vue';
import UiIcon from './UiIcon.vue';
// Core's close, dismiss and clear button: a UiButton with a fixed glyph and
// a required accessible name. `glyph` is `times` (the × character) or `icon`
// (the Material `close` symbol, sized by the caller's stylesheet). Attributes
// and classes pass through to the button, so each site keeps its id, its
// feature class and its look; a `title` passed in is its tip, and without
// one it has none. The kit class `ui-close-button` (close-button.css) is
// Core's common look, a bare glyph: no padding, border or background of its
// own, and a pointer. Its rule selects one class and loads before the
// feature stylesheets, so a feature rule still sets the size, colour, hover
// and any surface. `bare` leaves the kit look off, for a button whose skin
// keeps the browser's own padding.
const props = defineProps({
/** The accessible name (aria-label). */
label: { type: String, required: true },
glyph: {
type: String,
default: 'times',
validator: (value) => ['times', 'icon'].includes(value),
},
bare: { type: Boolean, default: false },
});
const emit = defineEmits(['click']);
</script>
<template>
<UiButton
:class="{ 'ui-close-button': !props.bare }"
:label="props.label"
:native-title="false"
@click="emit('click', $event)"
><UiIcon v-if="props.glyph === 'icon'" name="close" :size="null" /><template
v-else
>×</template
></UiButton
>
</template>