Skip to content

Commit 5d5f7ca

Browse files
authored
[docs][Slider] Prevent long presses from triggering context menu or text selection (#1339)
1 parent 140263d commit 5d5f7ca

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

docs/src/app/(public)/(content)/react/components/slider/demos/hero/css-modules/index.module.css

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
align-items: center;
55
width: 14rem;
66
padding-block: 0.75rem;
7+
touch-action: none;
8+
user-select: none;
79
}
810

911
.Track {
@@ -12,11 +14,13 @@
1214
background-color: var(--color-gray-200);
1315
box-shadow: inset 0 0 0 1px var(--color-gray-200);
1416
border-radius: 0.25rem;
17+
user-select: none;
1518
}
1619

1720
.Indicator {
1821
border-radius: 0.25rem;
1922
background-color: var(--color-gray-700);
23+
user-select: none;
2024
}
2125

2226
.Thumb {
@@ -25,6 +29,7 @@
2529
border-radius: 100%;
2630
background-color: white;
2731
outline: 1px solid var(--color-gray-300);
32+
user-select: none;
2833

2934
&:focus-visible {
3035
outline: 2px solid var(--color-blue);

docs/src/app/(public)/(content)/react/components/slider/demos/hero/tailwind/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { Slider } from '@base-ui-components/react/slider';
44
export default function ExampleSlider() {
55
return (
66
<Slider.Root defaultValue={25}>
7-
<Slider.Control className="flex w-56 items-center py-3">
8-
<Slider.Track className="h-1 w-full rounded bg-gray-200 shadow-[inset_0_0_0_1px] shadow-gray-200">
9-
<Slider.Indicator className="rounded bg-gray-700" />
10-
<Slider.Thumb className="size-4 rounded-full bg-white outline outline-1 outline-gray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-800" />
7+
<Slider.Control className="flex w-56 touch-none items-center py-3 select-none">
8+
<Slider.Track className="h-1 w-full rounded bg-gray-200 shadow-[inset_0_0_0_1px] shadow-gray-200 select-none">
9+
<Slider.Indicator className="rounded bg-gray-700 select-none" />
10+
<Slider.Thumb className="size-4 rounded-full bg-white outline outline-1 outline-gray-300 select-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-800" />
1111
</Slider.Track>
1212
</Slider.Control>
1313
</Slider.Root>

0 commit comments

Comments
 (0)