Skip to content

Commit

Permalink
fix(Clickable): use correct CSS property values (#7908)
Browse files Browse the repository at this point in the history
h2. Описание

Поправил значения свойства `-webkit-tap-highlight-color` на валидное `transparent` вместо `none`.

- caused by #6881

**UPD**

см. #7908 (review)

- перенёс `-webkit-tap-highlight-color` в `.realClicable`;
- перенёс логику `getUserAgentResetClassName` в CSS – увеличили специфичность, но для этих стилей допустимо

h2. Release notes
h2. Исправления
- Tappable: в кликабельных компонентах исправлена проблема, когда при касании через тач появлялся системный оверлей
  • Loading branch information
inomdzhon authored Nov 7, 2024
1 parent 9a424fd commit 3751c47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
9 changes: 5 additions & 4 deletions packages/vkui/src/components/Clickable/Clickable.module.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
.realClickable {
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}

.resetButtonStyle {
/* stylelint-disable selector-max-type */
button.realClickable {
appearance: none;
user-select: none;
-webkit-tap-highlight-color: none;
-webkit-touch-callout: none;
-webkit-user-drag: none;
}

.resetLinkStyle {
a.realClickable {
appearance: none;
-webkit-tap-highlight-color: none;
text-decoration: none;
}
/* stylelint-enable selector-max-type */

.host:focus,
.host:focus-visible {
Expand Down
16 changes: 1 addition & 15 deletions packages/vkui/src/components/Clickable/Clickable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,6 @@ function component<T>({
return {};
}

const getUserAgentResetClassName = (Component?: React.ElementType) => {
if (Component === 'a') {
return styles.resetLinkStyle;
}
if (Component === 'button') {
return styles.resetButtonStyle;
}
return;
};

/**
* Базовый кликабельный корневой компонент.
*
Expand All @@ -204,11 +194,7 @@ export const Clickable = <T,>({
}: ClickableProps<T>): React.ReactNode => {
const commonProps = component(restProps);
const isClickable = checkClickable(restProps);
const baseClassName = classNames(
baseClassNameProp,
getUserAgentResetClassName(commonProps.Component),
styles.host,
);
const baseClassName = classNames(baseClassNameProp, styles.host);

if (isClickable) {
return (
Expand Down

0 comments on commit 3751c47

Please sign in to comment.