Skip to content
Open
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
14 changes: 14 additions & 0 deletions .changeset/touch-select-papercuts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@kernelui-lib/styles": patch
"@kernelui-lib/react": patch
"@kernelui-lib/elements": patch
---

Stop tap flash and accidental text selection on clickable controls.

The reset now includes `label` (tapping a checkbox label highlighted the
label, not the input) plus the widget roles, kills the iOS long-press
callout on chrome, and sets `user-select: none` on buttons, summaries, and
labels. React and Web Components pair `-webkit-user-select` everywhere
selection is suppressed, including nav, breadcrumbs, and chips. Links stay
selectable so copying their text still works.
8 changes: 7 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@ new component done, grep both `packages/react/src/index.ts` and
was for, and a drag from a control selects text across the page. Pair it
with `-webkit-user-select: none` for Safari. Same rule for gutters that
aren't content: line numbers and diff markers are `user-select: none` so
a copy contains code, not decoration.
a copy contains code, not decoration. Tap flash and the iOS long-press
callout are a reset concern, not a per-component one: `packages/styles`'
reset kills `-webkit-tap-highlight-color` and sets `touch-action:
manipulation` on `a`/`button`/`input`/`label`/`summary` and the widget
roles, and `-webkit-touch-callout: none` on the clickable-chrome subset
(not links — long-press to open in a new tab stays). Omitting `label`
from that list is how a checkbox tap still flashes grey on iOS.
- **Motion baseline** (tokens in `packages/styles/src/tokens.css`, craft
bar from [transitions.dev](https://transitions.dev/) + Emil): enter with
`--kernel-ease-overlay` / `--kernel-ease-out`, never `ease-in` on
Expand Down
14 changes: 13 additions & 1 deletion apps/docs/src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ h3 {
background: none;
color: var(--kernel-color-text-muted);
cursor: default;
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
transition: background-color var(--kernel-duration-fast) var(--kernel-ease-out),
color var(--kernel-duration-fast) var(--kernel-ease-out);
}
Expand Down Expand Up @@ -280,6 +283,7 @@ p.docs-sidebar-eyebrow:first-child {
gap: var(--kernel-space-2);
cursor: pointer;
list-style: none;
-webkit-user-select: none;
user-select: none;
}

Expand Down Expand Up @@ -364,6 +368,8 @@ p.docs-sidebar-eyebrow:first-child {
border-inline-start: var(--kernel-border-width) solid transparent;
padding-inline-start: var(--kernel-space-3);
margin-inline-start: calc(var(--kernel-space-3) * -1 - var(--kernel-border-width));
-webkit-user-select: none;
user-select: none;
transition: color var(--kernel-duration-fast) var(--kernel-ease-out),
border-color var(--kernel-duration-fast) var(--kernel-ease-out);
}
Expand Down Expand Up @@ -445,6 +451,8 @@ dialog.mobile-nav-panel[data-side="left"] {
font-size: var(--kernel-font-size-sm);
text-decoration: none;
white-space: nowrap;
-webkit-user-select: none;
user-select: none;
}

.site-header-registry-link svg {
Expand Down Expand Up @@ -663,6 +671,8 @@ dialog.mobile-nav-panel[data-side="left"] {
minimum costs no layout. */
min-block-size: 24px;
color: var(--kernel-color-text);
-webkit-user-select: none;
user-select: none;
}

.site-header-logo-icon {
Expand Down Expand Up @@ -1373,8 +1383,8 @@ dialog.mobile-nav-panel[data-side="left"] {
background: transparent;
color: var(--kernel-color-text);
cursor: grab;
user-select: none;
-webkit-user-select: none;
user-select: none;
inline-size: 5.5rem;
flex: 0 0 auto;
translate: var(--desktop-nudge-x, 0) var(--desktop-nudge-y, 0);
Expand Down Expand Up @@ -2213,6 +2223,7 @@ dialog.mobile-nav-panel[data-side="left"] {
font-weight: 500;
cursor: default;
list-style: none;
-webkit-user-select: none;
user-select: none;
transition: background-color var(--kernel-duration-fast) var(--kernel-ease-out);
}
Expand Down Expand Up @@ -2260,6 +2271,7 @@ dialog.mobile-nav-panel[data-side="left"] {
resizing, matching the library Accordion's own rule. */
.usage-accordion[data-state="opening"] .usage-accordion-content,
.usage-accordion[data-state="closing"] .usage-accordion-content {
-webkit-user-select: none;
user-select: none;
}

Expand Down
2 changes: 2 additions & 0 deletions packages/elements/src/components/Accordion/Accordion.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ kernel-accordion-item:last-of-type .kernel-Accordion-item {
font-weight: 500;
cursor: default;
list-style: none;
-webkit-user-select: none;
user-select: none;
transition: background-color var(--kernel-duration-fast) var(--kernel-ease-out);
}
Expand Down Expand Up @@ -85,6 +86,7 @@ kernel-accordion-item:last-of-type .kernel-Accordion-item[open] .kernel-Accordio
.kernel-Accordion-item[data-state="opening"] .kernel-Accordion-content,
.kernel-Accordion-item[data-state="closing"] .kernel-Accordion-content {
overflow: clip;
-webkit-user-select: none;
user-select: none;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ kernel-breadcrumb-item {
color: var(--kernel-color-text-muted);
text-decoration: none;
border-radius: var(--kernel-radius-sm);
-webkit-user-select: none;
user-select: none;
}

/* Guarded, matching the React package: on a touch device :hover latches
Expand Down
3 changes: 3 additions & 0 deletions packages/elements/src/components/Button/Button.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
white-space: nowrap;
text-decoration: none;
cursor: default;
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
transition:
background-color var(--kernel-duration-fast) var(--kernel-ease-out),
border-color var(--kernel-duration-fast) var(--kernel-ease-out),
Expand Down
2 changes: 2 additions & 0 deletions packages/elements/src/components/Carousel/Carousel.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ kernel-carousel-slide {
cursor: default;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
transition: background-color var(--kernel-duration-fast) var(--kernel-ease-out);
}
Expand Down Expand Up @@ -96,6 +97,7 @@ kernel-carousel-slide {
border-radius: var(--kernel-radius-full);
background-color: var(--kernel-color-border-interactive);
cursor: default;
-webkit-user-select: none;
user-select: none;
transition: background-color var(--kernel-duration-fast) var(--kernel-ease-out);
}
Expand Down
2 changes: 2 additions & 0 deletions packages/elements/src/components/Checkbox/Checkbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
cursor: pointer;
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
font-family: var(--kernel-font-sans);
font-size: var(--kernel-font-size-base);
color: var(--kernel-color-text);
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/components/CodeBlock/CodeBlock.css
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ kernel-code-block {
color: var(--kernel-color-text-muted);
font-variant-numeric: tabular-nums;
text-align: end;
user-select: none;
-webkit-user-select: none;
user-select: none;
}

.kernel-CodeBlock-lineText {
Expand Down
1 change: 1 addition & 0 deletions packages/elements/src/components/Combobox/Combobox.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
cursor: default;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
cursor: default;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions packages/elements/src/components/DataTable/DataTable.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
cursor: pointer;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
}

Expand Down
2 changes: 2 additions & 0 deletions packages/elements/src/components/DatePicker/DatePicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
cursor: pointer;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
transition:
background-color var(--kernel-duration-fast) var(--kernel-ease-out),
Expand Down Expand Up @@ -96,6 +97,7 @@
cursor: pointer;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
transition:
background-color var(--kernel-duration-fast) var(--kernel-ease-out),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
cursor: pointer;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
transition:
background-color var(--kernel-duration-fast) var(--kernel-ease-out),
Expand Down Expand Up @@ -100,6 +101,7 @@
cursor: pointer;
/* Also matters here beyond the usual convention: hovering across cells
while previewing/selecting a range must not drag-select day text. */
-webkit-user-select: none;
user-select: none;
transition: scale var(--kernel-duration-fast) var(--kernel-ease-out);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ kernel-menu-separator {
cursor: default;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
transition:
background-color var(--kernel-duration-fast) var(--kernel-ease-out),
Expand Down
4 changes: 2 additions & 2 deletions packages/elements/src/components/FileDiff/FileDiff.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ kernel-file-diff {
text-align: end;
vertical-align: top;
white-space: nowrap;
user-select: none;
-webkit-user-select: none;
user-select: none;
}

/* The +/− marker is real text, not a colour. Colour alone doesn't say whether
Expand All @@ -137,8 +137,8 @@ kernel-file-diff {
padding-inline-start: var(--kernel-space-2);
vertical-align: top;
white-space: pre;
user-select: none;
-webkit-user-select: none;
user-select: none;
}

.kernel-FileDiff-row[data-kind="add"] .kernel-FileDiff-marker {
Expand Down
2 changes: 2 additions & 0 deletions packages/elements/src/components/FileUpload/FileUpload.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
text-align: center;
cursor: pointer;
overflow: hidden;
-webkit-user-select: none;
user-select: none;
transition:
border-color var(--kernel-duration-enter) var(--kernel-ease-overlay),
Expand Down Expand Up @@ -236,6 +237,7 @@
/* A drag gesture that starts on/near a file row shouldn't fight the
browser's own text-selection heuristics — nothing in the row is
meant to be selected as text. */
-webkit-user-select: none;
user-select: none;
}

Expand Down
2 changes: 2 additions & 0 deletions packages/elements/src/components/Label/Label.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
font-size: var(--kernel-font-size-sm);
font-weight: 500;
color: var(--kernel-color-text);
-webkit-user-select: none;
user-select: none;
}

.kernel-Label-required {
Expand Down
2 changes: 2 additions & 0 deletions packages/elements/src/components/Nav/Nav.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ kernel-nav-link {
color: var(--kernel-color-text-muted);
text-decoration: none;
font-size: var(--kernel-font-size-sm);
-webkit-user-select: none;
user-select: none;
transition:
background-color var(--kernel-duration-fast) var(--kernel-ease-out),
color var(--kernel-duration-fast) var(--kernel-ease-out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ kernel-nav-menu-item {
cursor: default;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
transition:
background-color var(--kernel-duration-fast) var(--kernel-ease-out),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
cursor: pointer;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
transition:
background-color var(--kernel-duration-fast) var(--kernel-ease-out),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ kernel-pagination-ellipsis {
font-variant-numeric: tabular-nums;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
transition: background-color var(--kernel-duration-fast) var(--kernel-ease-out);
}
Expand Down
3 changes: 3 additions & 0 deletions packages/elements/src/components/RadioGroup/RadioGroup.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
cursor: pointer;
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
font-family: var(--kernel-font-sans);
color: var(--kernel-color-text);
}
Expand Down Expand Up @@ -108,6 +110,7 @@
}

.kernel-RadioGroup-label {
-webkit-user-select: none;
user-select: none;
}

Expand Down
2 changes: 2 additions & 0 deletions packages/elements/src/components/Reasoning/Reasoning.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
padding-block: var(--kernel-space-2);
cursor: default;
list-style: none;
-webkit-user-select: none;
user-select: none;
}

Expand Down Expand Up @@ -65,6 +66,7 @@
.kernel-Reasoning-root[data-state="opening"] .kernel-Reasoning-content,
.kernel-Reasoning-root[data-state="closing"] .kernel-Reasoning-content {
overflow: clip;
-webkit-user-select: none;
user-select: none;
}

Expand Down
4 changes: 4 additions & 0 deletions packages/elements/src/components/Resizable/Resizable.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
}

.kernel-Resizable-root[data-dragging] {
-webkit-user-select: none;
user-select: none;
}

Expand All @@ -28,6 +29,9 @@
position: relative;
flex-shrink: 0;
background-color: var(--kernel-color-border);
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
transition: background-color var(--kernel-duration-fast) var(--kernel-ease-out);
}

Expand Down
1 change: 1 addition & 0 deletions packages/elements/src/components/Select/Select.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
font-size: var(--kernel-font-size-base);
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
transition: border-color var(--kernel-duration-fast) var(--kernel-ease-out),
scale var(--kernel-duration-fast) var(--kernel-ease-out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
cursor: default;
/* Same convention as Button/Checkbox/Switch: a clickable control's
own label text never drag-selects. */
-webkit-user-select: none;
user-select: none;
transition:
background-color var(--kernel-duration-fast) var(--kernel-ease-out),
Expand Down
3 changes: 3 additions & 0 deletions packages/elements/src/components/Switch/Switch.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
cursor: pointer;
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
font-family: var(--kernel-font-sans);
color: var(--kernel-color-text);
}
Expand Down Expand Up @@ -78,6 +80,7 @@
}

.kernel-Switch-label {
-webkit-user-select: none;
user-select: none;
}

Expand Down
Loading