Skip to content

Commit

Permalink
fix(Button,Link): return text select (#3538)
Browse files Browse the repository at this point in the history
  • Loading branch information
Funkicide authored Nov 8, 2024
1 parent 0c81931 commit 0c87bee
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
3 changes: 1 addition & 2 deletions packages/react-ui/components/Button/Button.styles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css, memoizeStyle, prefix } from '../../lib/theming/Emotion';
import { Theme } from '../../lib/theming/Theme';
import { resetButton, resetText, disableTextSelect } from '../../lib/styles/Mixins';
import { resetButton, resetText } from '../../lib/styles/Mixins';

import {
buttonUseMixin,
Expand All @@ -24,7 +24,6 @@ export const styles = memoizeStyle({
return css`
${resetButton()};
${resetText()};
${disableTextSelect()};
transition: background-color ${t.transitionDuration} ${t.transitionTimingFunction}
${t.btnBorderColorTransition ? `, ${t.btnBorderColorTransition}` : ''};
Expand Down
3 changes: 1 addition & 2 deletions packages/react-ui/components/Link/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { globalObject } from '@skbkontur/global-object';

import { ButtonLinkAllowedValues } from '../../lib/types/button-link';
import { resetButton, disableTextSelect } from '../../lib/styles/Mixins';
import { resetButton } from '../../lib/styles/Mixins';
import { PolymorphicPropsWithoutRef } from '../../lib/types/polymorphic-component';
import { keyListener } from '../../lib/events/keyListener';
import { Theme, ThemeIn } from '../../lib/theming/Theme';
Expand Down Expand Up @@ -185,7 +185,6 @@ export class Link<C extends ButtonLinkAllowedValues = typeof LINK_DEFAULT_COMPON
className: cx({
[styles.root(this.theme)]: true,
[resetButton()]: Root === 'button',
[disableTextSelect()]: disabled || loading,
[styles.focus(this.theme)]: isFocused,
[styles.disabled(this.theme)]: disabled || loading,
[styles.useDefault(this.theme)]: use === 'default',
Expand Down
12 changes: 0 additions & 12 deletions packages/react-ui/lib/styles/Mixins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,3 @@ export const resetText = () => {
text-shadow: none;
`;
};

export const disableTextSelect = () => {
return css`
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome, Edge, Opera and Firefox */
`;
};

0 comments on commit 0c87bee

Please sign in to comment.