Problem/Motivation
Drupal core includes a vertical tabs implementation, but no support for horizontal client-side tabs. In Drupal 6 the Tabs module provided a client-side tabs API, but that module is not being continued for Drupal 7.
Tabs are a commonly used interface element. It would be valuable to have a horizontal tabs implementation alongside the other existing elements provided by Elements.
Proposed resolution
Provide a horizontal tabs implementation closely mirroring the vertical tabs provided by Drupal core.
This approach does not use the tabs library that ships with Jquery UI.
An initial commit was made in a new branch of Elements, 1034690-horizontal-tabs.
Remaining tasks
- Patch needs review by Elements maintainer.
- Write tests for horizontal tabs. Existing patch includes only a stub test. Should be feasible to crib and adapt from FormsElementsVerticalTabsFunctionalTest in core.
- Assess/address Chrome display issue noted in #72.
User interface changes
Will provide a new horizontal tabs user interface element.
API changes
Provides a new element type, 'horizontal_tabs'.
Original report by Dave Reid
The Field group module contains a 'Horizontal tabs' element that would be nice if it could be re-used by other modules easily. Also, not having summaries makes them easier to use as well.
Comment | File | Size | Author |
---|---|---|---|
#50 | elements_horizontal_tabs_1034690_50.patch | 0 bytes | bforchhammer |
#56 | elements_horizontal_tabs_1034690_56.patch | 13.83 KB | bforchhammer |
#54 | elements_horizontal_tabs_1034690_54.patch | 13.79 KB | bforchhammer |
#51 | elements_horizontal_tabs_1034690_51.patch | 13.72 KB | bforchhammer |
#49 | elements_horizontal_tabs_1034690_49.patch | 13.71 KB | Stalski |
Comments
Comment #1
BenK CreditAttribution: BenK commentedSubscribing
Comment #2
james.elliott CreditAttribution: james.elliott commentedThis patch adds the horizontal tabs implementation from http://drupal.org/project/ux_elements
Comment #3
james.elliott CreditAttribution: james.elliott commentedIgnore the last patch, I forgot the -N switch to add the necessary css and js files
Comment #5
james.elliott CreditAttribution: james.elliott commented#3: elements_horizontal_tabs.patch queued for re-testing.
Comment #7
nedjoGood addition to Elements.
I'd like to deprecate the tabs module in favour of a horizontal tabs element in Elements. See #1056562: Deprecate Tabs module for D7 in favor of Elements.
Comment #8
james.elliott CreditAttribution: james.elliott commentedI'm not sure why this is failing testing. I'll have to scrub the line endings and then reroll.
Comment #9
Vc Developer CreditAttribution: Vc Developer commentedSubscribing!
Comment #10
ogi CreditAttribution: ogi commentedsubscribe
Comment #11
james.elliott CreditAttribution: james.elliott commentedRetrying with a scrubbed line ending patch
Comment #12
james.elliott CreditAttribution: james.elliott commentedComment #13
ogi CreditAttribution: ogi commentedsubscribe
Comment #14
ogi CreditAttribution: ogi commentedI tested #11 and it works except that all tab titles are prepended with "Hide ". The reason is that fieldset legend is
<span class="fieldset-legend"><a class="fieldset-title" href="#"><span class="fieldset-legend-prefix element-invisible">Hide</span> TAB</a><span class="summary"></span></span>
and it's taken with$.text()
which removes all markup including.element-invisible
. I tried to use.html()
instead of.text()
but extra borders appear and CSS needs to be fixed too.Comment #15
bryancasler CreditAttribution: bryancasler commentedsubscribe
Comment #16
Danny_Joris CreditAttribution: Danny_Joris commentedsubscribing
Comment #17
Dave ReidStarted an issue branch just for this: git clone --branch 1034690-horizontal-tabs http://git.drupal.org/project/elements.git
Comment #18
klonos...subscribing.
Comment #19
jdwfly CreditAttribution: jdwfly commented+1
Comment #20
EndEd CreditAttribution: EndEd commentedsubscribe
Comment #21
infines CreditAttribution: infines commented+1
Comment #22
infines CreditAttribution: infines commentedWhat is the status of this issue? How close is it to being committed?
Comment #23
aspilicious CreditAttribution: aspilicious commentedsubscribe
Comment #24
DamienMcKennaSubscribe.
Comment #25
Jerome F CreditAttribution: Jerome F commentedWhat does this module in git posted in #17 do? Is it a repository that other modules can use to implement tabs? Is that something that could be used to port panels tabs for example?
(subscribing the end ? http://drupal.org/node/34496 - http://3281d.com/2009/03/27/death-to-subscribe-comments)
Comment #26
bryancasler CreditAttribution: bryancasler commented+1 for some panels tabs up in here! ...also same question.
Comment #27
klonos...the git branch is what the word says, a 'fork' of the main module code that will have changes only regarding this issue here. I guess Dave did this in order to not mix code changes here with other changes.
Comment #28
jonathangreen CreditAttribution: jonathangreen commentedwhat is wrong with the current code in GIT? Is there a reason its not in main yet?
If someone wants to let me know whats wrong I can spend some time cleaning this up. I need this for a module I am moving to Drupal 7. We used to use the Tabs module, but its been deprecated in favor of elements, so I'd like to see this make it into the next release of elements.
Comment #29
droplet CreditAttribution: droplet commented+1
Comment #30
jmones CreditAttribution: jmones commentedsubscribe
Comment #31
elly CreditAttribution: elly commentedsubscribey - would really like to take a crack at using this in a panels style or porting panels tabs. +1 on #28, any new status since #14 test?
Comment #32
infines CreditAttribution: infines commentedMight as well just use Quick tabs with Panels now.
Comment #33
elly CreditAttribution: elly commentedThanks, had never heard of quicktabs. I can't tell if it offers a panels style plugin (which would be ideal) but will check it out.
Comment #34
bryancasler CreditAttribution: bryancasler commentedYou can make quicktabs and then insert them into panels, like content panes
Comment #35
lpalgarvio CreditAttribution: lpalgarvio commented+1
Comment #36
paulgemini CreditAttribution: paulgemini commented+1
Comment #37
adamdicarlo CreditAttribution: adamdicarlo commentedSubscribing.
Comment #38
infines CreditAttribution: infines commented#32-#34 describes a solution to your tab needs. It doesn't appear the maintainer is interested in this.
Comment #39
lpalgarvio CreditAttribution: lpalgarvio commentedTabs + Panel Tabs modules also work well.
could be of interest to merge Tabs into Elements.
Comment #40
Dave ReidWTF - who ever said I'm not interested in it? I was the one that started this issue - I'm just busy and don't have all the time in the world to work on it. Anyone can help work, patch, review, and RTBC this issue. Generally I can't devote attention to an issue until it is RTBC.
Comment #41
Damien Tournoud CreditAttribution: Damien Tournoud commentedI pointed zuuperman and Stalski (the maintainers of Field Group) to this issue by email.
Comment #42
jwilson3subscribe.
Comment #43
Stalski CreditAttribution: Stalski commentedIncluded is a first patch.
Crosslinking #1036184: Move horizontal tabs to elements module
Comment #44
Stalski CreditAttribution: Stalski commentedThere was still one link to field_group module in it, this really works :)
Comment #46
Stalski CreditAttribution: Stalski commentedAfter a quick review by Damien, I moved the library requirement to the element_info hook instead of the theme function.
Fieldgroup keeps working.
Comment #48
bforchhammer CreditAttribution: bforchhammer commentedNo idea why the test bot fails, but I think you're patch is missing
horizontal-tabs.js
andhorizontal-tabs.css
...Comment #49
Stalski CreditAttribution: Stalski commentedYeah, damnd, the whole folder library folder actually. Forgot to add :(
Comment #50
bforchhammer CreditAttribution: bforchhammer commentedCool, patch is looking good. I applied it and tested it with References Tabs. It's working fine apart from one issue:
In line 137,
horizontal-tabs.js
tries to call$.fn.drupalGetSummary()
, which is defined inform.js
. Thesystem/drupal.form
library is not loaded if there's no form, and I therefore get errors which prevent the tabs from being rendered (this.fieldset.drupalGetSummary() is not a function
).A simple fix is to simply load the library (patch attached). Not sure that's the best solution, as e.g. many people might not even need "tab summaries"; but then form.js is relatively small anyway...
Comment #51
bforchhammer CreditAttribution: bforchhammer commentedHm.
Comment #52
Stalski CreditAttribution: Stalski commentedCorrect. That's one that I forget and did not test through. I added the form library within the field_group module before.
Patch is good.
Comment #53
Dave ReidWe should declare the form.js dependency in elements_library() instead of having to add the library just like system_library() does for vertical tabs.
Comment #54
bforchhammer CreditAttribution: bforchhammer commentedLike this? ;-)
Comment #56
bforchhammer CreditAttribution: bforchhammer commentedHm, without --no-prefix then...
Comment #57
giorgio79 CreditAttribution: giorgio79 commentedWhy a custom horizontal tab element? What is wrong with Jquery UI Tabs? There is also a patch here
#1263616: jQuery UI form elements? for this module
PS: I found the reasons here #1056562: Deprecate Tabs module for D7 in favor of Elements...
Comment #58
Stalski CreditAttribution: Stalski commented@giorgio79 The horizontal tabs described here are a copy of the vertical tabs element in core. It is currently defined within field_group.
We cannot suddenly give people something totally different, introduce new bugs as lot of code would be rewritten in field_group. The module has now over 10000 users and I can't just suprise every user when upgrading. It can be inbedded in sites as it is and so on ...
You could certainly go further with the other elements that are related in usability. The future will tell us which way to go and probably that will be the way drupal8 tabs will end up using. There is absolutely nothing wrong with jquery ui tabs but that's another approach than the consistent vertical/horizontal issue.
For now, we start with this and go from there.
Comment #59
jsacksick CreditAttribution: jsacksick commentedsuscribing
Comment #60
Stalski CreditAttribution: Stalski commentedCan someone test the patch in #56 ?
Comment #61
bforchhammer CreditAttribution: bforchhammer commentedI can confirm that it works fine with References Tabs. That is, the following works: create a form element of
#type
horizontal_tabs
, add fieldsets as children and on each fieldset set#group
to the id of thehorizontal_tabs
element. This produces horizontal tabs. (As far as I can tell this works essentially the same asvertical_tabs
in core).Comment #62
jsacksick CreditAttribution: jsacksick commentedI can also confirm that it works fine, tested and used with a "port" of panels tabs for d7 => http://drupal.org/sandbox/jsacksick/1251912
Comment #63
bforchhammer CreditAttribution: bforchhammer commentedSo... RTBC? (Sorry if I'm being rash)
Comment #64
Stalski CreditAttribution: Stalski commentedGood for me. There is a change made in horizontal tabs, so I'll resubmit a patch.
Also see #1036184: Move horizontal tabs to elements module which needs review.
Comment #65
bforchhammer CreditAttribution: bforchhammer commentedAny progress on the updated patch, Stalski?
Comment #66
Stalski CreditAttribution: Stalski commentedThe branch 7.x-2.x in field_group does not have horizontal tabs anymore. It also works with the renderable elements module. I'll talk to Dave about this and I hope I can commit this patch.
Bumping this :)
Comment #67
klonosYeah, this module deserves a fresh dev with this included.
Comment #68
bforchhammer CreditAttribution: bforchhammer commentedFriendly 3-week bump :)
Comment #69
Dave ReidThanks everyone for the hard work on this. Slating this for review this weekend.
Comment #70
klonosHey Dave, how about that review?
Comment #71
PESTO3567 CreditAttribution: PESTO3567 commentedPatch still works fine, waiting for the next dev release ;-)
Comment #72
PESTO3567 CreditAttribution: PESTO3567 commentedBtw, with Google Chrome I've got a ugly orange border around & below the tabs, the following fixed it:
.horizontal-tabs ul.horizontal-tabs-list li:focus {
outline: none !important;
}
Comment #73
Alan D. CreditAttribution: Alan D. commentedPing some life back into this hopefully. The Tabs module recommends this module for this functionality and is one of the reasons that it is not being ported to Drupal 7.
Comment #73.0
nedjoCreate summary.
Comment #74
nedjoI had a crack at capturing status in a summary for the issue. Corrections/additions would be great.
Bumping to "needs review" as current patch hasn't yet received serious review.
This sort of UI patch tends to be challenging to review as it includes significant complexity in CSS and Javascript as well as PHP. But don't feel like you need to master CSS, Js and PHP to contribute. Separate reviews of each of these three would be a good start.
Comment #75
jwilson3CSS review: A nit-pick, but these are examples of overqualified specificity, and should be trimmed down to just classes, if possible.
Comment #76
jwilson3Some of the files you're adding are missing newlines at the end of the file.
Comment #77
jwilson3I would agree, in principle, with the feedback in #72, but ideally, there would be a consistent "focus" behaviour for all tabs, not just horizontal ones.
Comment #78
kaizerking CreditAttribution: kaizerking commentedWhen i am trying embed field collection item in as horizontal tam, i dont see any result, am i missing something,
I have field collection items in prfile2 , and wanted to display each of them as a horizontal tab. it is not working, can some one throw some light please?
Comment #79
rp7 CreditAttribution: rp7 commentedWhat's the reasoning behind fieldsets being used for horizontal tabs?
Wether or not used in forms, both render valid for W3C - but semantically this doesn't seem be correct. For example, AnySurfer (http://www.anysurfer.be/en), a Belgian quality mark for accessible websites, does not condone the use of fieldsets outside of forms.
http://stackoverflow.com/questions/314457/does-the-use-of-the-fieldset-h... is an interesting resource about this matter, and most of the opinions seem to agree.
Comment #80
matt_paz CreditAttribution: matt_paz commentedAnyone have a feel for the status of this issue?
Comment #81
acoustika CreditAttribution: acoustika commentedIm not sure if my issue is related to this or field groups but I get no answer on that module...
I am using fieldgroup to make a node type tabbed, using horizontal tabs...
And have spend hours now trying to hide a field with drupals hide($content['field_name']);
Could not make it work until I tried dragging the field out of my horizontal tabs and to the top of all the other fields, and then it worked..... So I'm guessing this is related to fieldgroup module....
If I wanna hide the body i do hide($content['body']); But should the field naming scheme be different now that it is encapsulated in fieldsets?
Any thoughts on this? Im using the patch on #56
But to answer #80 it seems to be working just fine beside my theming issue...
I'm using it here to make nodes like mini pages, the black menu buttons is horizontal tabs...
It's a live site so dont register or anything :-) horizontal tabs in use
Comment #82
matt_paz CreditAttribution: matt_paz commentedI'm using the patch from 56 too ... was more interested in the "needs review" status
Comment #83
IKN CreditAttribution: IKN commentedI've removed my post about tabs for fields added to a single node as that functionality, however un-intuitive, is, indeed, in the core. Thank you!
Comment #84
Rob_Feature CreditAttribution: Rob_Feature commentedI got this error after enabling the module with the patch from #56:
Comment #85
bforchhammer CreditAttribution: bforchhammer commented@Rob_Feature: you can avoid the error by ugprading the field_group module to the 2-x version...
Comment #86
leex CreditAttribution: leex commentedSorry I don't know how to submit a patch yet but this could be added to the above patch around line 285
This helps to mimic the classes field group had for horizontal tabs.
Also, I suck at coding ^_^
Comment #87
DigitalFrontiersMedia@bforchhammer, from the field_group project page:
Comment #88
bforchhammer CreditAttribution: bforchhammer commented@DigitalFrontier... Thanks, good to know.
Comment #89
sinasalek CreditAttribution: sinasalek commentedIt's seem that latest version of field_group already supports horizontal_tab
Comment #90
bforchhammer CreditAttribution: bforchhammer commentedCorrect. The point of this issue was that it would be better located within the elements module instead of the fieldgroup module, and therefore the functionality should be moved...
Comment #91
almc CreditAttribution: almc commentedDoes the module version 7.x-1.4 contain horizontal tabs? haven't found mentioning of horizontal tabs in its code. Applied the patch 56 to it on D7.23, it said that the patch was applied partially. How can horizontal tab be added now programmatically to a form?
Comment #92
hass CreditAttribution: hass commented#56: elements_horizontal_tabs_1034690_56.patch queued for re-testing.
Comment #93.0
(not verified) CreditAttribution: commentedLink to 1034690-horizontal-tabs branch.
Comment #94
Stomper CreditAttribution: Stomper commentedWill Elements-based tabbed Views work with the EVA module? I'd like to attach a tabbed view to a node.