Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
javascript
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Sep 2012 at 20:10 UTC
Updated:
29 Jul 2014 at 21:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tim.plunkettTagging.
Comment #2
fabianx commentedSetting priority to major as per http://drupal.org/node/1608878#comment-6550574
Added tags from that issue.
Comment #3
kiphaas7 commentedEach drop button gets at least 3 classes added via js and an element added (the toggle). If that is going to happen at 50 or more drop buttons' its going to have an impact on mobile performance.
I'd propose to move all classes to php, change the CSS to
.js .classso it (still) only runs when js is enabled. Possibly also add the button already via php and hide it by default.Comment #4
kiphaas7 commentedSince dropbutton got commited, this one is active I guess?
Comment #5
attiks commentedFYI: I created #1805488: Dropbutton is causing a horizontal scrollbar to appear
Comment #6
Bojhan commentedI dont see how this issue is actionable, unless a patch comes up I say you split of those issues into seperate ones.
Comment #7
fabianx commentedHere is one important bug:
Dropbuttons are overlapping on a page if JS is off. (At least they did for me ...)
Comment #8
tim.plunkettLet's start it off with this.
Comment #9
kiphaas7 commentedA few days ago I had a testbranch (which I stupidly deleted, gah), where I tried to fix some of my own complaints (see #3). Basically, I had some trouble in getting the classes in the right places using PHP instead of JS (though that might be fixed by moving some of the CSS around, nothing serious).
But the real thing I was having trouble with, mostly finding an elegant solution for it, is that if I want to add the button element in PHP (which is now added via JS, which in big tables almost certainly will be a performance hog for mobile -> DOM manipulation), I have to pretty much change the entire render array. Because at this point, the render type is 'links', which won't work if I want to add a button.
So it would need to be an 'item_list'?
Anyway, apart from the dom creation, we would benefit already by adding the CSS classes in PHP.
http://jsperf.com/foobarfoofroo
(test results shown are my chrome, which seems to produce low results, and my iphone 4 running ios 6)
Comment #10
tim.plunkettThe first half of #9 sounds like #1777326: Replace theme_links() with theme_item_list()
The second half you'll have to take up with all three JS maintainers who co-wrote this code...
Comment #11
nod_ugh, duplicate. see below.
Comment #12
nod_Quick perf benchmark on average creating on button takes 1.1ms on my laptop. The contribution of the different parts is roughly:
adding .dropbutton-action to lis: 20%
adding mouseover events: 20%
adding the button html: 20%
doing the slice and adding .dropbutton-secondary: 20%
The rest is doing the
.find()and a few other stuff in the constructor, it's very small but the event binding takes a few more µs than adding the button to the DOM. I personally would like to get rid of the mouseover thing but that's an interaction change. Delegating mouseover event is a bad idea, we can't get away with it. At least not binding it for touch-enabled devices would help out.I'm for adding classes from the PHP if possible but the button should be added with JS. No surprises possible.
Comment #13
kiphaas7 commentedThose numbers coincide with my small bench. Reducing the button JS rendering time by 40% by adding the classes in PHP is already a nice improvement, and much less invasive than adding the button via PHP.
(which can end up toreducing the rendering time by 40-80ms, depending on the browser maybe more, so IMHO significant)
Comment #14
nod_If you like pref improvements have a look at the first column of this issue #1415788: Javascript winter clean-up that's where everything is kept :)
Comment #15
jessebeach commentedWe'll need to move the following code in
node.admin.cssto a more general place:It was meant to give us a direction for styling dropbuttons inside of admin tables. I don't think we have a CSS file yet that spans all forms. Maybe we could add /core/misc/forms.css or move the CSS above into the individual themes?
At the moment, I'm leaning to moving the code into the Seven and Bartik themes. Let the dropbuttons be statically positioned in Stark.
Comment #16
attiks commented#15 that css is now in dropbutton.base.css
Comment #17
attiks commentedI re-opened (and re-titled) #1805488-10: Dropbutton is causing a horizontal scrollbar to appear for the scrollbar problem.
Comment #18
jessebeach commented@attiks, ok, I thought I was looking at the right patch, but I guess I wasn't. So I'll propose the change I described in #15 and see what folks think about it.
Comment #19
attiks commentedOnly thing I notice is that after opening the operations I get an horizontal scrollbar, that isn't going away after closing the operations. Row height/Column width stay the same.
Comment #20
seutje commentedRemoved some redundant jQuery wrapping:
jQuery.fn.slicealready returns a jQuery collection, no need to wrap it again.Comment #21
seutje commentedWhen JavaScript is disabled, the widget is still absolutely positioned, this was causing them to overlap under certain conditions, making some links unreachable (with the pointer). (see attached screenshot)
I moved the absolute positioning to
.dropbutton-multiple .dropbutton-widgetselector, so it only gets applied when JavaScript is enabled and there are multiple items. This meant that I had to float the widget when there aren't multiple items (otherwise, it wouldn't be at the right side of the container).I also removed one
cursor: pointeras it was causing a pointer cursor when hovering the whitespace to the left of the widget.Comment #22
seutje commentedThe scrollbar issue (#1805488: Dropbutton is causing a horizontal scrollbar to appear) seems to be related to the
.element-invisibleclass on the toggle button's inner span. since it has a (forced) 1px height, and width auto, it still takes up space, effectively sticking out of its container.IMO, this is a bug with
.element-invisible, but for the sake of moving this issue along, I slapped aoverflow: hidden;on.dropbutton-arrow.Feel free to discard this patch and move the
.element-invisiblething to its own issue.Comment #23
tim.plunkettThese changes work well for views, it let's us remove about 20 lines of custom CSS to do pretty much the same thing. I'm attaching the Views patch here for my own sanity.
My additions follow the suggestion of #3, but for different reasons. The custom styling makes no sense with JS off, so I added the class.
Still remaining is the fact that on wide screens, it looks ridiculous to have it all the way to the right in a table. Views is manually overriding that still.
Comment #24
delmarr commentedAdding my first patch, please let me know if I've missed something.
This patch adjust the dropbuttons in /views_ui/css/views-admin.theme.css page. I've floated the button to the right if js is present and left the absolute position when js enabled. This prevents the overlapping and is accessible when js is disabled.
Comment #26
tim.plunkett#24, thanks for the patch, but that's unrelated to the core issue.
If you'd like, open an issue in the Views queue. Thanks!
Back to needs review for #23.
Comment #27
Bojhan commentedI noticed this created a pretty big bug floating everything to the right, so I would love to see this in.
Comment #28
jessebeach commentedIt seems that right-aligned buttons in table cells are not finding much favor. Since I'm in the minority on preferring it, I'll concede the issue and go with consensus. I made a few tweaks to this end (see the interdiff.txt). Nothing major I hope. Other than these changes, the rest of the patch looks good.
Left aligned dropbuttonsbuttons. Well, it's really no alignment. They line up with positioning origin.
Right aligned dropbuttons in RTL.
No-JS screenshot
Hiding overflowed dropbutton text.
so this doesn't happen
Comment #29
seutje commentedI assumed the right alignment was a requirement, but I like it a lot more when it's left aligned.
I still noticed 1 issue though, on very small window sizes, once triggered, the right side of the dropdown will be out of the viewport, causing a scrollbar to appear. But I wouldn't say it's a blocking issue, as it's only the last bit of the operation that might be a little hard to read for some people.

Comment #30
webchickHappy to commit this patch as a starting point once it's RTBC. It's unclear to me if this resolves the "major" part of this task.
Comment #31
dead_armI marked #1781406: Use the new Core dropbutton as a duplicate of this issue now that Views is in Core (yay!). Any changes made here should also be reflected in the Views CSS.
Comment #32
nod_Related #1824634: [meta] Dropbutton accessibility issues
Comment #33
seutje commentedAdded focusin and focusout handlers for keyboard navigation, they just route to hoverIn and hoverOut, but I kept them in their own functions so it's still possible for other scripts to swap them out and make the logic differ from hoverIn/Out.
was that the "major" part webchick was referring to or is there anything else?
Comment #34
fabianx commentedI think we need @sun to chime in here, but to #33:
We have:
Issues that need to be addressed.
in the issue summary.
Could you give an update of what is fixed of this within #33?
Comment #35
seutje commented1: That link doesn't rly tell me anything about what needs to change
2: Not addressed (but #1780852: Sticky tableheaders bleed-through makes me think this issue doesn't try to solve that, but rather marks it for removal once it does get fixed)
3: Addressed (I think)
4: Adressed (I think)
5: I intentionally didn't touch the markup as there doesn't seem to be any consensus on this, everybody wants their own markup... personally, I find it mighty awkward that the trigger for opening the dropbutton is the second
<li>and the rest gets this secondary-action class, or whatever...6: see 5
Comment #36
tim.plunkettResponding to #35:
1. Follow-ups at #1824634: [meta] Dropbutton accessibility issues and #1826368: Place dropbutton operations after their heading
2. #1780852: Sticky tableheaders bleed-through
3. Is addressed
4. Is addressed
5. Feature request
6. Feature request (that I'd like to won't fix)
So, I think we're done here.
Comment #37
dries commentedLooks good. Committed to 8.x. Thanks!
Comment #38
tim.plunkettWell, we never actually tested this in the actual Views UI.
Before:

After:

Comment #39
tim.plunkettSorry, correct patch.
Comment #40
sunYes, this patch wasn't ready yet. Like, at all.
The follow-up fix in #39 is required now. The issue should move back to active afterwards.
Comment #41
damiankloip commentedTim's patch fixes this for me.
Comment #42
webchickOk, committed and pushed that. Thanks!
I don't particularly see why we need to keep this issue open now, though. Seems like #36 showed that the bugs have follow-ups, and we can create some for those features that don't. I'm not sure how we're going to solve the remainder of the items in #36 any better at 43 comments in.
Comment #43
nod_Dropbutton still looks like crap on Firefox linux (fine in opera/chrome), arrow is too low and gradient starts from the left instead of bottom. We really need this gradient?
Comment #44
seutje commentedoh god, looks like FF16 interprets the unprefixed version differently from how FF before 16 interpreted the prefixed version
basically, spec says "0deg means bottom to top" and this is how the unprefixed version is implemented in FF16 (and up), but the original proposal by apple said "0deg means left to right"
so I guess our unprefixed declaration should use 180deg, while the prefixed versions should use -90deg or we use the keywords (but only for the unprefixed version), because right now, our implementation conflicts with the spec, so when everyone drops the prefixed versions, it'll be left-to-right on all browsers...
attached patch changes unprefixed version to 180deg to match the spec
reference: http://stackoverflow.com/questions/12868704/why-did-firefox-16-change-th...
Comment #45
fabianx commentedBack to NR then (or to followup-issue)
Comment #47
seutje commentedbot be tweakin!
Comment #48
aspilicious commented#44: dropbutton-1799498-45.patch queued for re-testing.
Comment #49
nod_please commit #44 dropbutton is looking stupid on good browsers.
We might want to generate some more markup on server side, with the update of Opera, there is some flash of unstlyed content going on.
Comment #50
webchickCommitted and pushed to 8.x. Thanks!
Comment #51
xjmRelated: #1824634: [meta] Dropbutton accessibility issues
Comment #52.0
(not verified) commentedAdd issue summary based on experiences from commited issue.