Improve click/touch without unintended interaction

Disable selecting clickables as text. Selecting buttons leads to
unintended selection. This is seen when touching on clickables using
mobile devices.

Prevent blue highlight when touching on clickables. This is seen on
mobile webkit browsers. It looks ugly and the visual clue provided is
not needed beacuse all clickables on mobile already  have visual clues.
This commit is contained in:
undergroundwires
2022-03-13 12:45:17 +01:00
parent 99e24b4134
commit 3233d9b802
12 changed files with 32 additions and 13 deletions

View File

@@ -14,3 +14,16 @@
}
}
}
@mixin clickable($cursor: 'pointer') {
cursor: #{$cursor};
user-select: none;
/*
It removes (blue) background during touch as seen in mobile webkit browsers (Chrome, Safari, Edge).
The default behavior is that any element (or containing element) that has cursor:pointer
explicitly set and is clicked will flash blue momentarily.
Removing it could have accessibility issue since that hides an interactive cue. But as we still provide
response to user actions through :active by `hover-or-touch` mixin.
*/
-webkit-tap-highlight-color: transparent;
}

View File

@@ -42,7 +42,7 @@ export default class Code extends Vue {
}
.copy-button {
margin-left: 1rem;
cursor: pointer;
@include clickable;
@include hover-or-touch {
color: $color-primary;
}

View File

@@ -42,7 +42,8 @@ export default class IconButton extends Vue {
box-shadow: 0 3px 9px $color-primary-darkest;
border-radius: 4px;
cursor: pointer;
@include clickable;
width: 10%;
min-width: 90px;
@include hover-or-touch {

View File

@@ -29,7 +29,7 @@ export default class MenuOptionListItem extends Vue {
@use "@/presentation/assets/styles/main" as *;
.enabled {
cursor: pointer;
@include clickable;
@include hover-or-touch {
font-weight:bold;
text-decoration:underline;

View File

@@ -52,7 +52,7 @@ $color : $color-primary-dark;
$color-hover : $color-primary;
.handle {
user-select: none;
@include clickable($cursor: 'ew-resize');
display: flex;
flex-direction: column;
align-items: center;

View File

@@ -130,7 +130,7 @@ $card-horizontal-gap : $card-gap;
padding-bottom: 0;
padding-left: $card-inner-padding;
position: relative;
cursor: pointer;
@include clickable;
background-color: $color-primary;
color: $color-on-primary;
font-size: 1.5em;
@@ -187,7 +187,7 @@ $card-horizontal-gap : $card-gap;
font-size: 1.5em;
align-self: flex-start;
margin-right: 0.25em;
cursor: pointer;
@include clickable;
color: $color-primary-light;
@include hover-or-touch {
color: $color-primary;

View File

@@ -33,8 +33,8 @@ export default class DocumentationUrls extends Vue {
.documentationUrl {
display: flex;
color: $color-primary;
cursor: pointer;
vertical-align: middle;
@include clickable;
@include hover-or-touch {
color: $color-primary-darker;
}

View File

@@ -65,7 +65,6 @@ $size-height : 30px;
// https://www.designlabthemes.com/css-toggle-switch/
.checkbox-switch {
cursor: pointer;
display: inline-block;
overflow: hidden;
position: relative;
@@ -87,7 +86,7 @@ $size-height : 30px;
margin: 0;
opacity: 0;
z-index: 2;
cursor: pointer;
@include clickable;
}
.checkbox-animate {

View File

@@ -137,7 +137,7 @@ $margin-inner: 4px;
margin-top: 1em;
color: $color-primary;
&__close-button {
cursor: pointer;
@include clickable;
font-size: 1.25em;
margin-left: 0.25rem;
@include hover-or-touch {

View File

@@ -52,7 +52,7 @@ export default class Dialog extends Vue {
font-size: 1.5em;
margin-right: 0.25em;
align-self: flex-start;
cursor: pointer;
@include clickable;
@include hover-or-touch {
color: $color-primary;
}

View File

@@ -69,12 +69,14 @@ function getOperatingSystemName(os: OperatingSystem): string {
</script>
<style scoped lang="scss">
@use "@/presentation/assets/styles/main" as *;
.url {
@include clickable;
&__active {
font-size: 1em;
font-size: 1em;
}
&__inactive {
font-size: 0.70em;
font-size: 0.70em;
}
}
</style>