Skip to content

Commit 4dabc21

Browse files
authored
Disallow selecting the text of buttons (#19330)
Introduce a CSS class `.unselectable`
1 parent 3255ba9 commit 4dabc21

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

web_src/less/_base.less

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,16 @@ a.commit-statuses-trigger {
255255
text-decoration: none !important;
256256
}
257257

258+
.unselectable {
259+
-webkit-touch-callout: none;
260+
-webkit-user-select: none;
261+
user-select: none;
262+
}
263+
264+
.button {
265+
&:extend(.unselectable);
266+
}
267+
258268
.ui.breadcrumb a:hover {
259269
text-decoration: underline !important;
260270
}
@@ -810,7 +820,6 @@ a.ui.card:hover,
810820
float: right;
811821
}
812822

813-
&.button,
814823
&.menu .item {
815824
user-select: auto;
816825
}
@@ -1526,12 +1535,12 @@ a.ui.label:hover {
15261535
}
15271536

15281537
.lines-num {
1538+
&:extend(.unselectable);
15291539
padding-left: 10px;
15301540
padding-right: 10px;
15311541
text-align: right !important;
15321542
color: rgba(27, 31, 35, .3);
15331543
width: 1%;
1534-
user-select: none;
15351544
font-family: var(--fonts-monospace);
15361545

15371546
span {
@@ -1616,21 +1625,18 @@ a.ui.label:hover {
16161625
}
16171626

16181627
.lines-commit {
1628+
&:extend(.unselectable);
16191629
vertical-align: top;
16201630
color: #999999;
16211631
padding: 0 !important;
16221632
background: var(--color-code-sidebar-bg);
16231633
width: 1%;
1624-
-moz-user-select: none;
1625-
-ms-user-select: none;
1626-
-webkit-user-select: none;
1627-
user-select: none;
16281634

16291635
.blame-info {
1636+
&:extend(.unselectable);
16301637
width: 350px;
16311638
max-width: 350px;
16321639
display: block;
1633-
user-select: none;
16341640
padding: 0 0 0 10px;
16351641
line-height: 20px;
16361642
box-sizing: content-box;
@@ -2159,9 +2165,9 @@ table th[data-sortt-desc] {
21592165
}
21602166

21612167
.ellipsis-button {
2168+
&:extend(.unselectable);
21622169
padding: 0 5px 8px !important;
21632170
display: inline-block !important;
2164-
user-select: none !important;
21652171
font-weight: 600 !important;
21662172
line-height: 6px !important;
21672173
vertical-align: middle !important;

web_src/less/_repository.less

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,7 @@
15831583
}
15841584

15851585
.line-num {
1586+
&:extend(.unselectable);
15861587
width: 1%;
15871588
min-width: 50px;
15881589
font-family: monospace;
@@ -1591,7 +1592,6 @@
15911592
white-space: nowrap;
15921593
vertical-align: top;
15931594
cursor: pointer;
1594-
user-select: none;
15951595
text-align: right;
15961596
background: var(--color-body);
15971597
border: 0;
@@ -1727,11 +1727,11 @@
17271727
background: var(--color-code-bg);
17281728

17291729
.lines-num {
1730+
&:extend(.unselectable);
17301731
text-align: right;
17311732
color: var(--color-text-light);
17321733
width: 1%;
17331734
min-width: 50px;
1734-
user-select: none;
17351735

17361736
span.fold {
17371737
display: block;
@@ -1774,9 +1774,9 @@
17741774
}
17751775

17761776
.lines-type-marker {
1777+
&:extend(.unselectable);
17771778
width: 10px;
17781779
min-width: 10px;
1779-
user-select: none;
17801780
}
17811781

17821782
[data-type-marker]::before {
@@ -2450,13 +2450,13 @@
24502450
}
24512451

24522452
.segment.language-stats {
2453+
&:extend(.unselectable);
24532454
padding: 0;
24542455
height: 11px;
24552456
display: flex;
24562457
white-space: nowrap;
24572458
width: 100%;
24582459
border-radius: 0;
2459-
user-select: none;
24602460

24612461
@media @mediaSm {
24622462
display: none;

web_src/less/_review.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050

5151
.show-outdated,
5252
.hide-outdated {
53+
&:extend(.unselectable);
5354
display: block !important;
54-
user-select: none !important;
5555

5656
&:hover {
5757
text-decoration: underline;

web_src/less/markup/content.less

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -527,12 +527,7 @@
527527
margin-right: 10px !important;
528528

529529
i {
530-
-webkit-touch-callout: none;
531-
-webkit-user-select: none;
532-
-khtml-user-select: none;
533-
-moz-user-select: none;
534-
-ms-user-select: none;
535-
user-select: none;
530+
&:extend(.unselectable);
536531
}
537532
}
538533

0 commit comments

Comments
 (0)