Skip to content

Commit

Permalink
Disallow selecting the text of buttons (#19330)
Browse files Browse the repository at this point in the history
Introduce a CSS class `.unselectable`
  • Loading branch information
delvh authored Apr 14, 2022
1 parent 3255ba9 commit 4dabc21
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
22 changes: 14 additions & 8 deletions web_src/less/_base.less
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,16 @@ a.commit-statuses-trigger {
text-decoration: none !important;
}

.unselectable {
-webkit-touch-callout: none;
-webkit-user-select: none;
user-select: none;
}

.button {
&:extend(.unselectable);
}

.ui.breadcrumb a:hover {
text-decoration: underline !important;
}
Expand Down Expand Up @@ -810,7 +820,6 @@ a.ui.card:hover,
float: right;
}

&.button,
&.menu .item {
user-select: auto;
}
Expand Down Expand Up @@ -1526,12 +1535,12 @@ a.ui.label:hover {
}

.lines-num {
&:extend(.unselectable);
padding-left: 10px;
padding-right: 10px;
text-align: right !important;
color: rgba(27, 31, 35, .3);
width: 1%;
user-select: none;
font-family: var(--fonts-monospace);

span {
Expand Down Expand Up @@ -1616,21 +1625,18 @@ a.ui.label:hover {
}

.lines-commit {
&:extend(.unselectable);
vertical-align: top;
color: #999999;
padding: 0 !important;
background: var(--color-code-sidebar-bg);
width: 1%;
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
user-select: none;

.blame-info {
&:extend(.unselectable);
width: 350px;
max-width: 350px;
display: block;
user-select: none;
padding: 0 0 0 10px;
line-height: 20px;
box-sizing: content-box;
Expand Down Expand Up @@ -2159,9 +2165,9 @@ table th[data-sortt-desc] {
}

.ellipsis-button {
&:extend(.unselectable);
padding: 0 5px 8px !important;
display: inline-block !important;
user-select: none !important;
font-weight: 600 !important;
line-height: 6px !important;
vertical-align: middle !important;
Expand Down
8 changes: 4 additions & 4 deletions web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,7 @@
}

.line-num {
&:extend(.unselectable);
width: 1%;
min-width: 50px;
font-family: monospace;
Expand All @@ -1591,7 +1592,6 @@
white-space: nowrap;
vertical-align: top;
cursor: pointer;
user-select: none;
text-align: right;
background: var(--color-body);
border: 0;
Expand Down Expand Up @@ -1727,11 +1727,11 @@
background: var(--color-code-bg);

.lines-num {
&:extend(.unselectable);
text-align: right;
color: var(--color-text-light);
width: 1%;
min-width: 50px;
user-select: none;

span.fold {
display: block;
Expand Down Expand Up @@ -1774,9 +1774,9 @@
}

.lines-type-marker {
&:extend(.unselectable);
width: 10px;
min-width: 10px;
user-select: none;
}

[data-type-marker]::before {
Expand Down Expand Up @@ -2450,13 +2450,13 @@
}

.segment.language-stats {
&:extend(.unselectable);
padding: 0;
height: 11px;
display: flex;
white-space: nowrap;
width: 100%;
border-radius: 0;
user-select: none;

@media @mediaSm {
display: none;
Expand Down
2 changes: 1 addition & 1 deletion web_src/less/_review.less
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@

.show-outdated,
.hide-outdated {
&:extend(.unselectable);
display: block !important;
user-select: none !important;

&:hover {
text-decoration: underline;
Expand Down
7 changes: 1 addition & 6 deletions web_src/less/markup/content.less
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,7 @@
margin-right: 10px !important;

i {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
&:extend(.unselectable);
}
}

Expand Down

0 comments on commit 4dabc21

Please sign in to comment.