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
Fix for opening accordion item on iOS devices #355
Comments
Thanks for filing this, @Techn1x. A PR would be great. Any opinion on this beforehand, @simonihmig? |
I haven't done a lot of PR's on this project, what would be the best way to do this? I went to add this: /* iOS fix - elements aren't clickable without pointer */
attributeBindings: ['style'],
style: 'cursor:pointer', To the base bs-accordion item component here: Which works, but got a warning Not really sure where to define classes for this addon either |
You can get around that with this: style: 'cursor:pointer'.htmlSafe() But this is still dirty (and not something I would expect in an addon) instead I would leverage the component's class and add it into the CSS. What confuses me is why the Bootstrap CSS that this addon imports does not already have this in their accordion styles. |
@sukima Is this BS3 or BS4? They're not really doing anything on BS3 now and this may not have been a behavior they anticipated when BS3 was under development. If it still exists in BS4, it should be an issue against twbs/bootstrap while they're still bringing it to fruition. |
What do you see when you run |
Definitely BS3, not sure if issue is present in BS4. I found a better fix for this. Inside native BS3 stylesheets there is this that I could use for accordion items; // iOS "clickable elements" fix for role="button"
//
// Fixes "clickability" issue (and more generally, the firing of events such as focus as well)
// for traditionally non-focusable elements with role="button"
// see https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile
[role="button"] {
cursor: pointer;
} As for BS4, this discussion looks relevant; But I am not sure what is the best way to proceed. I can add role="button" to the base accordion item, the other solution seems to be to add an empty click handler to target or any ancestor |
This looks like the best solution IMHO. I would 👍 this. |
|
Seems the original Bootstrap example does not support clicking the anywhere in the header, only on the The Maybe we should add a |
Hmm, in terms of UI and usability, that's a strange choice by bootstrap.... make something look like a button, but actually only the title acts like a button. I definitely prefer the approach of making the whole thing a button/tab. So what's the best approach here, a more generic style like [role="tab"] {
cursor: pointer;
} Or something specific to just accordions (would require making a new class, I think?) .accordion-heading {
cursor: pointer;
} |
Thanks to @sukima for the fix
Before the ember-bootstrap beta.1 release, on iOS devices (or at least, iOS 10 anyway), clicking the accordion item anywhere didn't open the accordion.
On beta.1, it was now possible to click the title to open the accordion item (but clicking the accordion item itself still did not work.) This was likely due to this fix #311
It turns out, that iOS devices refuse to click on elements that aren't
<button>
or<a>
. To allow clicking on other elements (such as<div>
) need to apply the stylecursor: pointer;
to the element - doing this fixes the issue on iOS.Should this style/class be added by default to accordion items so that they work on iOS? I can probably to a PR if needed
The text was updated successfully, but these errors were encountered: