when the uri fragment identifier links to an element in a collapsed fieldset, i wish the "collapsed" class were removed from that fieldset, so the browser can move the view port to that element and the element is visible
currently the "collapsed" class is removed from fieldsets which contain elements matching the selector, 'input.error, textarea.error, select.error', so that errors are visible. this patch adds ":target" to that selector, so the "collapsed" class is also removed from fieldsets which contain the target of the uri fragment identifier.
in other words, given the markup,
[...]
[...]
[...]
- when accessed with the uri, http://...#foo, the "collapsed" class will be removed from the fieldset, so the browser can move the view port to the div and the div is visible
Comment | File | Size | Author |
---|---|---|---|
#11 | collapse-anchor.patch | 779 bytes | casey |
#3 | collapsetarget.patch | 796 bytes | casey |
#1 | 535966.patch | 718 bytes | jablko |
Comments
Comment #1
jablko CreditAttribution: jablko commentedoops, guess that markup shoulda been,
Comment #3
casey CreditAttribution: casey commentedI agree on the idea.
The uri fragment identifier however can easily change. So this patch isn't complete. We could use the hashchange event. For cross-browser compatibility we would need jquery.ba-bbq.js. Needs some discussion.
Comment #4
casey CreditAttribution: casey commentedLets forget hashchange for a moment and focus on the easy part first.
Patch still applies.
Comment #5
casey CreditAttribution: casey commentedtagging
Comment #6
Dries CreditAttribution: Dries commentedI'm confused by the comments above. Are you recommending we commit this 'as is' or are you saying we need to do more work on it?
Comment #7
casey CreditAttribution: casey commentedOh, I am sorry. Yes I mean commit this 'as is'. It is functional as long as the hash doesn't change.
The part that doesn't work is when you click an anchor-link that is inside an collapsed fieldset, the fieldset won't automaticly open.
Comment #8
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #9
Kiphaas7 CreditAttribution: Kiphaas7 commentedGot this error in firebug console:
uncaught exception: Syntax error, unrecognized expression: Syntax error, unrecognized expression: target
After debugging, it turns out the following line is responsible:
Which is exactly what this patch changed...
Since the :target selector is not listed in the api (http://api.jquery.com/category/selectors/), I don't think it is actually supported by jquery?
Maybe some code of the link below can be used instead..
http://stackoverflow.com/questions/1451292/what-does-selector-ahref-mean...
Comment #10
casey CreditAttribution: casey commentedI am pretty sure it worked. Apparently jQuery 1.4 doesn't support it any more. I'll have another look today.
Comment #11
casey CreditAttribution: casey commentedThis should work.
Comment #12
tobiasbComment #13
Kiphaas7 CreditAttribution: Kiphaas7 commentedCode looks good, but is there some page to test this? Only page I thought of was the modules page in core, but that fieldset is already visible.
Also curious if this goes well with overlay fragments.
It went in once with code that totally broke collapsible fieldsets, let's not rush in another one...
Comment #14
casey CreditAttribution: casey commentedCould be tested on
http://localhost/drupal7/#overlay=admin/structure/taxonomy/tags/add%23ed...
of without overlay
http://localhost/drupal7/admin/structure/taxonomy/tags/add#edit-weight
Comment #15
Kiphaas7 CreditAttribution: Kiphaas7 commentedpatch works.
Comment #16
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.