|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
c960657 Smarty Regular
Joined: 07 May 2003 Posts: 75 Location: Copenhagen, Denmark
|
Posted: Thu Jul 29, 2004 8:52 am Post subject: IE6-incompatible use of <label> in html_radios/checkbo |
|
|
The html_radios and html_checkboxes plugins generate HTML like this:
Code: | <label><input type="radio" name="radio" value="1" />Monday</label> |
This is valid HTML4, and it does work as expected in e.g. Mozilla, but not in Internet Explorer 6 (or earlier). Clicking on the label does not focus or change the input control.
Something like the following is also HTML4-compliant and will work in both Mozilla and IE6:
Code: | <input type="radio" name="radio" id="somethingunique" value="1" /><label for="somethingunique">Monday</label> |
Considering that IE6 has a market share above 90%, I think it is worth changing the behaviour of these plugins. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Jul 29, 2004 9:00 am Post subject: |
|
|
this was already discussed on the smarty-general mailinglist, but not solved, yet. see:
http://marc.theaimsgroup.com/?l=smarty-general&m=107346592603810&w=2
the question is, if we possibly introduce any problems by adding these ids.
i wouldn't want to break a single smarty template with that just because others don't get their things right.
BTW: maybe the 90% market-share is not a reason to change smarty but more a reason for 90% of web-users to change their software. |
|
Back to top |
|
c960657 Smarty Regular
Joined: 07 May 2003 Posts: 75 Location: Copenhagen, Denmark
|
Posted: Thu Jul 29, 2004 9:31 am Post subject: |
|
|
What kind problems do you have in mind? Of course the ids should be chosen, so that it is very unlikely that there will be duplicates. If uniqid() is used, we should be fairly sure. Or perhaps uniqid() is overkill (AFAIR uniqid() is pretty slow).
With respect to compatibility with existing stylesheets, my suggestion about moving the <label> tag to after the <input> tag is probably a bad idea. Just adding "id" and "for" to the existing output, as suggested on the mailing list, will be better.
Quote: | BTW: maybe the 90% market-share is not a reason to change smarty but more a reason for 90% of web-users to change their software. |
As long as you cannot find a browser that supports all of HTML4.01 without any bugs, I don't think that argument is valid.
Of course Smarty could make a political decision about not adding features only to please IE6 users even though the feature is easy implementable and standards-compliant. For my personal pet projects I would be inclined to follow that policy. But when I work for paying customers, I may not always agree. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Jul 29, 2004 11:54 am Post subject: |
|
|
c960657 wrote: | What kind problems do you have in mind?
|
clashing ids, of course.
Quote: | Of course the ids should be chosen, so that it is very unlikely that there will be duplicates. If uniqid() is used, we should be fairly sure. Or perhaps uniqid() is overkill (AFAIR uniqid() is pretty slow). |
yes, it's slow.
Quote: | With respect to compatibility with existing stylesheets, my suggestion about moving the <label> tag to after the <input> tag is probably a bad idea. Just adding "id" and "for" to the existing output, as suggested on the mailing list, will be better.
Quote: | BTW: maybe the 90% market-share is not a reason to change smarty but more a reason for 90% of web-users to change their software. |
As long as you cannot find a browser that supports all of HTML4.01 without any bugs, I don't think that argument is valid.
Of course Smarty could make a political decision about not adding features only to please IE6 users
|
i am not political, at least not regarding smarty.
Quote: | even though the feature is easy implementable and standards-compliant. |
it's not that easy, IMHO.
Quote: | For my personal pet projects I would be inclined to follow that policy. But when I work for paying customers, I may not always agree. |
html_radios is not smarty. it's just a plugin, just an add-on. you are not forced to use it for your paying customers. you are not even forced to ship it with your Smarty.class.php . |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Jul 29, 2004 12:24 pm Post subject: |
|
|
FWIW: i wouldn't add "for" and "id" blindly to every checkbox/radiobutton.
I'd more like an attribute "id_prefix" or "prefix". id's would only be added when this attribute is given and this attributes would give the template-author control about the uniquenes, because he choses the (hopefully unique) prefix.
This would leave current uses of html_checkboxes as is which lowers the possibilities of any damages. |
|
Back to top |
|
c960657 Smarty Regular
Joined: 07 May 2003 Posts: 75 Location: Copenhagen, Denmark
|
Posted: Thu Jul 29, 2004 12:29 pm Post subject: |
|
|
messju wrote: | c960657 wrote: | What kind problems do you have in mind?
|
clashing ids, of course.
|
If we use a prefix of, say, "smartyautogeneratedid" or something even more obscure (it could even be user configurable), I doubt it will cause any real-world problems, if the string is obscure enough.
Of course there is small chance that it will cause compatibility problems. That is always the case when changing the behaviour of software (that's why it is important to read the changelog before upgrading anything). But compared to other bug fixes and feature additions I think this is low risk.
BTW, reserving a prefix for ids used internally by Smarty may turn out to be useful for other purposes. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|