Skip to content

Commit

Permalink
Merge pull request #1680 from epam/#1679-page-scrolling-on-click
Browse files Browse the repository at this point in the history
#1679 remove autofocus on click
  • Loading branch information
Mariia-Katkova authored Jul 5, 2022
2 parents 1736d9a + 24c8917 commit ee94b0a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class ClipArea extends Component {
if (
el === event.target ||
(!isActiveElement(event.target) && this.props.focused())
)
autofocus(el)
) {
autoselect(el)
}
},
mousedown: (event) => {
if (event.shiftKey && !isActiveElement(event.target))
Expand Down Expand Up @@ -104,9 +105,8 @@ function isActiveElement(el) {
return ['INPUT', 'SELECT', 'TEXTAREA', 'OPTION', 'LABEL'].includes(el.tagName)
}

function autofocus(cliparea) {
function autoselect(cliparea) {
cliparea.value = ' '
cliparea.focus()
cliparea.select()
}

Expand Down

0 comments on commit ee94b0a

Please sign in to comment.