Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidebar not able to close in mobile browser, if tapped on the sidebar launcher icon #1683

Closed
Nithya opened this issue Jan 22, 2015 · 3 comments
Milestone

Comments

@Nithya
Copy link

Nithya commented Jan 22, 2015

This issue is reproducable in http://semantic-ui.com/modules/sidebar.html also.

In my page, I had used attach event for setting launcher btn for sidebar as below
$('#sidebar-right').sidebar('attach events', '.sidebar-toggle-btn')

Step1 -> clicking on the sidebar-toggle-btn, shows the sidebar.

Step2 -> When using in Desktop => clicking on the sidebar-toggle-btn, triggers the sidebar toggle event and since sidebar is already visible, it hides the sidebar as expected.

Step 2 again in Mobile => clicking on the sidebar-toggle-btn, triggers the 'clickaway' function as the button is part of the dimmed page, also it moves to showing of the sidebar as well but it also ends up calling sidebar toggle event based on the 'attach event' setting and ends up closing the sidebar.

Couldnt figure out why it happens only in mobile.

I tried in my Mobile browser(chrome) and through browser mobile emulation - both had same results.

Please help me out guys.

Thanks in Advance.

@jlukic
Copy link
Member

jlukic commented Jan 22, 2015

There might be another explanation. The default transition is set to auto which uses is mobile to determine which animation to use. Mobile was using RegExp.test which would return false for mobile when called twice.

As with exec (or in combination with it), test called multiple times on the same global regular expression instance will advance past the previous match.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test

@jlukic
Copy link
Member

jlukic commented Jan 22, 2015

I can confirm this fixes issues with docs sidebar button. Thanks for spotting this issue.

@jlukic jlukic closed this as completed Jan 22, 2015
@Nithya
Copy link
Author

Nithya commented Jan 23, 2015

Hey Jack,
Thanks for the Quick response.
Would applying the same fix from your commit to build-1.7.3 fix the issue or would there be someother changes needed to fix this in 1.7.3 ?

I tried the same changes available in you commit in build-1.7.3 but it didnt solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants