Skip to content
This repository was archived by the owner on Jan 21, 2019. It is now read-only.

Conversation

rybmat
Copy link
Contributor

@rybmat rybmat commented Nov 30, 2018

This change fixes issues on mobile safari where in some cases user needed to tap twice in order to see dropdown content

@Wikia/iwing

@rybmat rybmat requested a review from bkoval November 30, 2018 14:12
@rybmat rybmat requested a review from vforge as a code owner November 30, 2018 14:12

componentDidMount() {
this.setState({
isTouchDevice: typeof window !== 'undefined' && ('ontouchstart' in window),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only odd thing about having it here
is that any time you'll render Dropdown component you'll check if it is still a touch device...
@xkxd @latata is there a solution to this? or is it just how it is?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll go with this solution to unblock development since we're wrapping up dropdowns, but let's keep discussion open about patterns like this.

This code is moved to componentDidMount as we know for sure it runs immediately component is mount on the browser side - this way we overwrite the isTouchDevice value which is set to false on the SSR side immediately after rendering the component.

@bkoval bkoval merged commit a2ed59f into master Dec 3, 2018
@bkoval bkoval deleted the IW-1347 branch December 3, 2018 08:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants