-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Links not clickable in <label> tags #3595
Comments
This would be extremely useful. Imagine a scenario where you build a checkbox representing a user's acceptance of agb/terms and conditions. This is represented with a checkbox, a corresponding label including a sentence and one or more links within this sentence ("I accept the terms and conditions as well as other conditions."). A click on the links opens the new page but does not opt in the checkbox (e.g. if the sentence contains two links then the checkbox would be unchecked after the user read both of the link contents); on the other hand the checkbox is only opted in when the label area is clicked but not the link itself. The default behaviour for labels could be a click on the label opts in/out the checkbox. The option to follow links could be activated directly on the label element by setting a data-follow-links="true" attribute. I have currently worked around this issue by catching clicks on link elements within labels, preventing the default behaviour and opening the link in a new subpage via ajax. |
Since this is not a bug I am closing this issue as a feature request. My personal opinion on this feature is that it's not a good idea to have a link wrapped inside another link (button). On a touch device there is a big chance you hit the link when you want to click the button. |
@uGoMobi -- Done |
Hi @uGoMobi ! |
hi @MauriceG If there is no downside to adding that filter, it's fine by me. I would just not recommend using it like this. I think a link inside a button is a bad UI. |
@uGoMobi it's a link inside a , not a button per-se. My exact use case that led me to this problem was trying to add a "I agree to the Terms of Service" checkbox and having 'Terms of Service' linked with a label. Ended up needing to have a separate link to the TOS and then add the checkbox w/label separate, which seemed silly. |
A link inside an anchor element would be invalid markup: We are talking about a link inside a label element. That's valid markup, but in case of JQM the label element of a checkbox gets button behaviour and styling. I understand why you want to use it like that, but for the reasons I mentioned in my previous comments I wouldn't recommend it. That's just my opinion on good UI and touch-optimized. I think I would go for the separate link or a native checkbox. |
If @toddparker is in favor of making links inside checkbox labels possible, can you create a PR for it? Jasper |
I agree with @uGoMobi - if this doesn't impact performance, I'm fine with making this adjustment but it does seem like the UI might not be very usable. |
Checkbox/Radio: Make links inside labels clickable. Addresses #3595
Much appreciated |
Update: I had to revert the change because it broke the tests we run to see if everything is still working as expected. See also: #4665 (comment) |
since the merge was reverted, this issue should be reopened |
I restored the link to this ticket on the feature request page. We reopen when we are going to work on new solution. |
Still no change on this? |
Please see below examples:
Standard browser functionality that allows clicking links in labels without auto-checking the related checkbox:
http://patrickclinger.com/github/label-links-without-jqm.html
jQuery Mobile that does not allow the link to be clicked at all, and just checks the box:
http://patrickclinger.com/github/label-links-jqm.html
The text was updated successfully, but these errors were encountered: