It's pretty minor, but if we are looking at little UI nits like #297209: Remove 'Attach' button then how about this:
Current action:
- to make a menu, user opens the fieldset
- User retypes the title they just typed in above into that field (!)
- selects parent etc
- it saves, because there's text there.
To delete
- fieldset starts open
- They read the text 'Delete this menu item.' and tick "yes"
- saving deletes it.
Suggested alternative:
- User opens the fieldset
- There is an unchecked checkbox saying "Create a menu item"
- User ticks the box
- Menu title autopopulates from the node title
- User can then modify it, but probably not
- Done
To Delete:
- Fieldset is open.
- User removes the tick from the box
- (optionally fieldset closes or title is blanked)
- Menu is no longer saved
Pretty smooth?
I did it that way when I replicated menu for edit_term screenshot. Not by conscious choice, but because it was reflecting what I wanted to do - have a menu or not have a menu.
And then I looked at the existing menu logic that checks for the delete flag, and I was happy I'd done it my way.
Those folk who have seen that checkbox in action - even/especially the ones who were used to having it work exactly opposite - immediately said "Hey, that makes more sense" citation needed
Just wondering if there's enough support out there for this radical inversion of thinking for it to be worth trying out a patch (my first real brush with D7)
PS.
When making a menu, if you change your mind, you delete the menu by blanking the text. Um, not a major mental leap, but slightly subtle. OK.
When editing later, blanking the text does NOT delete the menu, in fact it comes back again. Hm. Yes, there's a checkbox there now, treating 'deleting a menu' like a preference you want to keep. :-}
If nothing else, shouldn't blanking the menu also cause deletion? Or is that covering up a weakness in the current approach? Possibly a weakness that predates FAPI? Something about not being able to detect the submission of empty fields?
.dan.
Comment | File | Size | Author |
---|---|---|---|
#72 | menu-322703-59+69.patch | 1.55 KB | alexkb |
#69 | menu-322703-69.patch | 1.02 KB | alexkb |
#59 | drupal.menu-link-auto.59.patch | 894 bytes | sun |
#58 | drupal.menu-link-auto.54.patch | 485 bytes | seutje |
#53 | drupal.menu-link-auto.53.patch | 16.28 KB | sun |
Comments
Comment #1
Bojhan CreditAttribution: Bojhan commentedCan you please supply a clear screenshot with the problem, and the proposed solution? I am kind of torn between all you'r questions, assumptions and notions that I can't and hopefully others as well, what your proposing. You'r title is quite confusing, I tried to reword it but probally failed.
I am looking foward to a response, as it seems you encounterd this a lot of times.
Comment #2
dman CreditAttribution: dman commentedok ... here's a full mock-up.
I have no idea what you did to my issue title :-/
I'll try again.
Simply, checkboxes indicate that a persistent option is positively selected, chosen.
Using them to trigger actions is weird, and only justified if you need to make multiple selections (eg pre-AJAX webmail forms).
If the menu wanted the "Delete" action, it should be an action button.
.dan.
Comment #3
keith.smith CreditAttribution: keith.smith commentedAutomatically populating the menu item title with the title of the node is a great idea; it's something that I've often wished for myself, but failed to create an issue or patch. Thank you!
Your suggested logic regarding the check box is a substantial improvement as well. So far, this sounds like a good plan.
Comment #4
yoroy CreditAttribution: yoroy commentedAaaah, much better. I suspected it was about something like this but wasn't sure either :) Good presentation and a fine proposal me thinks. Using a checkbox for a delete action is indeed strange. And your proposed new workflow looks like it would be a lot more intuitive. Probably needs some more discussing the technicalities, can't help there but: Good Idea.
Comment #5
Rowanw CreditAttribution: Rowanw commentedIt's a fine idea and would certainly be an improvement.
Going by the suggested approach, the menu settings (title, description and parent) would be redundant as long as the checkbox is unchecked. Some users may fill out the menu settings while failing to check the checkbox.
Comment #6
dman CreditAttribution: dman commentedEntering text in a blank menu title should cause the checkbox to get ticked client side.
We can even keep the existing behavior to create a menu when text is there server side.
Comment #7
Bojhan CreditAttribution: Bojhan commentedAhh, after the mockups has been placed I totally get it, sounds good. As yoroy said, we need some reviews.
Comment #8
dman CreditAttribution: dman commentedAnother thought:
To be really intuative - just have a checkbox, not a collapsed fieldset visible at first.
Checking the box reveals the fieldset. Unchecking blanks and collapses it.
Although that's a little too different from the current UI? And needs odd work for non-js usability maybe.
If we could get the checkbox embedded in the legend? I don't know if I could safely hack that in though...
Comment #9
yoroy CreditAttribution: yoroy commenteddman: These are all real cool ideas. If you are up to quickly prototyping workable demos of these variations that would rule. Doesn't even have to be functional, but just demonstrate the flow. It's hard to base this on just thoughts, we'd want to user experience it :)
Comment #10
dman CreditAttribution: dman commentedbump.
FWIW, a fully working demo of this behaviour IS available within the edit_term module for D5.
- unfortunately something needs to be changed to make it work in D6 again... Not sure what.
Comment #11
Aren Cambre CreditAttribution: Aren Cambre commentedI will reference this request in #483078: Menu item name should be node title by default. I think both these requests are complimentary:
I also recommend #576916: Default menu "Parent item" should be Navigation, not Primary links so that new links default to Navigation instead of Primary links. Primary links are space-limited and need to be minimal to be effective. Navigation is the workhorse and should be where links go unless otherwise specified.
The confluence of all three issues is a really easy way to add a menu item for the node: just check a box, and it "just works". With this, you might even hide all the menu details by default, assuming that the vast majority of links will be fine with these default settings.
Comment #12
Aren Cambre CreditAttribution: Aren Cambre commentedSimplifying title and filing in the proper component.
Comment #13
BarisW CreditAttribution: BarisW commentedI think that this could be handled by jQuery alone. When jQuery is disabled, the functionality remains the same. What should jQuery do:
menu.js
I'll have a look!
Comment #14
BarisW CreditAttribution: BarisW commentedComment #15
BarisW CreditAttribution: BarisW commentedThis should do the trick, please test.
- When checked, it copies the value of the page title to the menu title field.
- It is always possible to override the menu title.
- When the menu title is cleared, the checkbox will be unchecked as well.
Comment #16
Dries CreditAttribution: Dries commentedI haven't reviewed the code yet but I tested it, and I like what this patch does.
I think this provides us an opportunity to provide some better text. Instead of 'Create new menu item' maybe we could say something like 'Add a link to this post from the site navigation' or something.
Comment #17
BarisW CreditAttribution: BarisW commented- Changed tabstops to spaces
- Changed the text to Add a link to this post from the site navigation, I agree with Dries on this.
Comment #18
Aren Cambre CreditAttribution: Aren Cambre commentedBarisW: I like where you're going, but be careful about changing the menu name field only with Javascript. That's why #410464: Menu name = node title upon node edit through user interface failed. See Dries's comment in #48 and mine in #50. That feature could initially populate the menu name upon menu item creation but couldn't keep the menu name field in sync with future node title changes. Also, being Javascript-only, no fix could keep the menu name in sync after API-based node edits.
A complete solution needs PHP changes and probably needs to use the node title for the menu name if the menu name field is blank. See #483078: Menu item name should be node title by default.
Comment #19
dman CreditAttribution: dman commented#410464: Menu name = node title upon node edit through user interface was closed because it was split off to continue here, wasn't it?
This one-time client-side, UI-only assist through js is just usability. There is no need to extend it to the much bigger issue of keeping things in synch everywhere always. That's not what is being promised.
Copying the title down to the empty menu title field is no more than a form of handy auto-completion! We don't complain that autocomplete is insufficient because it doesn't continue to update anything once it's been used and saved.
So long as menu titles and node titles are being stored in different fields in the database, they have the ability - by design - to be out of synch, even if once upon a time they were identical.
It's simply a "that's convenient :-)" moment vs a "bugger, I have to re-type the same thing again :-?" issue.
Comment #20
Aren Cambre CreditAttribution: Aren Cambre commented@dman: Is it obvious to novices? What will they think when the menu name doesn't change after node title changes?
I still maintain that the best design should start with "blank menu name = use node title." If menu logic is well-encapsulated, then the change ought to be achievable for 7.x.
Does Javascript prepopulation takes Drupal further from this? Is that good?
Comment #21
BarisW CreditAttribution: BarisW commentedFor me it´s very clear that the menu title could differ from the node title (eg: Contact form as Node title and Contact as Menu title).
When a user checks the checkbox, the menu name = node title. This is always overrideable (is that a word?).
When the menu field already contains text, the node title will not be copied into it. So indeed, if a user changes the node title afterwards, the menu title remains. And I think this is a good idea (and works the same as the Path settings, these also remain the same after a node title change).
I agree with @dman: this is just added value and doesn't need any PHP. It just makes editing quicker and easier for end-users. And it is degradeable to the current functionality when the users doesn't have Javascript enabled.
Comment #22
Dries CreditAttribution: Dries commentedCoding style: needs space between ) and {.
Coding style: else statement should be on different line.
I'm on crack. Are you, too?
Comment #23
BarisW CreditAttribution: BarisW commentedTnx for the tips, I'll read the coding style guide :)
Attached a new version.
- Added a newline and a space :p
Comment #24
BarisW CreditAttribution: BarisW commentedTnx for the tips, I'll read the coding style guide :)
Attached a new version.
- Added a newline and a space :p
Comment #25
moshe weitzman CreditAttribution: moshe weitzman commentedSomething is wrong with most recent patch. The link in invalid. Test bot can't can't test it. Please rename and re-upload.
Comment #26
BarisW CreditAttribution: BarisW commentedI think I pressed the upload button twice, which also removed the tags.
Re-added them and uploaded the patch again.
Comment #28
BarisW CreditAttribution: BarisW commentedAgain...
Comment #29
yoroy CreditAttribution: yoroy commentedfor bot
Comment #30
BarisW CreditAttribution: BarisW commentedGuys, we need some testers to get this RBTC.
Please help :)
Comment #31
sunThis got committed by accident and is horribly broken. I searched for a couple of hours for the actual issue.
Comment #32
Shai CreditAttribution: Shai commentedWe've got a process issue here: how to work on something that was committed by accident?
I opened a related issue yesterday which @sun marked as a duplicate of this. Not a 100% sure that is the case: #620314. My complaint is that the node/xxx/edit form does not display saved settings for the menu link title, parent, and weight. in a pretty consistent way in Drupal, node/add and node/xxx/edit are the same form and node/xxx/edit retrieves the current value for all the fields. In D6, the node/xxx/edit form does indeed show you the current value of the menu link title, parent and weight.
It is not clear to me from this thread whether the current values for the menu link (title, parent, weight) were supposed to be retrieved or not. I do hope it was the intention of the new functionality to retrieve the values of the existing setting for node/xxx/edit, which is consistently the case for Drupal forms.
While this situation here is messy, I'm going to toss out two related things for reference. I do this not to confuse the matter, but to try to get related issues on the table.
It seems that someone (@Dries?, @Webchick?) needs to step in and provide some order here about how to sort all this out.
Shai
Content2zero
Comment #33
sunThis is what you want, I think. Works nicely for me.
Has only one minor race condition: The vertical tabs fieldset summary is not directly updated when toggling the checkbox.
Comment #34
sunuhm. We have some more work to do here.
Comment #35
Shai CreditAttribution: Shai commented@sun, great job. I tested the patch. It applied cleanly and worked as expected. Great noticing the awful help text. My attached mock-up has alternative text. I guess for usability and search I'll repeat text from the graphic here.
The menu link title will be the clickable text for the menu item.
Menus are enabled by content-type. Go to content-type settings and click on Menu Settings tab to enable a menu for this content-type
[It would be nice to have a hyperlink here directly to the settings for the appropriate content-type... Can you have hyperlinks that will open a field set?]menu items with a higher number appear lower in the list.
Weird behavior I'm seeing on my install: In Garland, primary nav items have anchor title attribute set to be = $node -> title. Menus items in the left sidebar have no title attribute set. Are other people seeing that?
I feel we are moving from chaos to order!
Comment #36
Shai CreditAttribution: Shai commentedRe: @sun in #34. Not sure programmatically what the reasons are for the two boxes or what the upshot of changing two check boxes to one would be.
But assuming we need to have two boxes... if the description text could say "Create menu link" before anything has ever been saved there and switch to "View menu link settings" after it had been saved once... I think we would remove a lot of the confusion. Would that contextually conditional display text be hard to do?
Shai
Comment #37
dman CreditAttribution: dman commented@shai - we definitely do not want 2 checkboxes! That's the WTF
It's just the one option, on or off. If "create" and "delete" are incorrect (I think so, because they are actions, and a checkbox indicates a state) then a more passive-voice "provide a menu item" sounds better to me.
Comment #38
sunThanks, Shai.
Honestly, I think that this info is superfluous. By renaming the label to "Link text", we can drop the entire description.
Unfortunately, the select list contains both menus AND links. As long as that is the case, I think that "Parent item" is the most precise thing we can call it.
That entire help text is for site administrators only, and many users won't even have permissions to alter the content-type settings.
Since the current description is plain nuts, I think we can just drop this entire description as well.
For now, I'd just drop the "Optional." Easily explaining how the weighing works to someone who mainly doesn't care is a really tough call. In reality, the entire weight widget makes no sense and is the wrong interface element, but that is to be discussed and resolved in other issues. See #491022: Remove weight field from menu item entity forms and #605894: Replace menu weight selector on node/add with relative item positioning.
And re: #36:
Yes, we can merge those checkboxes into one, which will also simplify the JS of this patch a bit, because it currently takes special care for not submitting a link title when the checkbox is disabled.
Comment #39
sunSo here we go.
This may sound funny, but I really hope that at least some tests will fail. Otherwise, this entire node menu widget does not have any tests.
Comment #40
Shai CreditAttribution: Shai commented@sun, sorry that your patch didn't fail :)
I reverted to the latest dev version of 7 and then applied the patch in #39. It applied cleanly. It seems to be behaving as designed. This is sooo much better. One caveat is that I'm watching the world series so I'm a bit distracted. But I'm a Phillies fan so I'm having fun :).
@sun, can you comment on:
Shai
Comment #41
sunWell, then we also need to add tests here.
Shai:
1) That's not related to this issue/patch. See #378064: Description field missing in menu settings on node form.
2) Equally not, but not sure whether there's an issue for that.
Comment #42
sunUntil there are tests...
Comment #43
sun.
Comment #44
Bojhan CreditAttribution: Bojhan commented.
Comment #45
sunuhm, was that a total sign-off from the UX team? ;) (please note the changed labels and vanished descriptions in the before/after screenshots above :)
Comment #46
Bojhan CreditAttribution: Bojhan commented@tha_sun We tried to be equally cryptic to your drutastic image :P. The "please note" really helps, although I am unsure if you now fixed the issue in #34 of having two checkboxes.
I think the descriptions removal is good, although the label change on "Link text" should be reverted to "Menu link title". That label tested well, no reason to change something that tests well.
Comment #47
Shai CreditAttribution: Shai commented@Bojhan, the latest patch from #39 does indeed fix the two box problem pointed out in #34.
Shai
Comment #48
sunThe direct comparison is before and after.
1) There is only one checkbox "Provide a menu link".
2) The label "Menu link title" was renamed to "Link text", because half of the lengthy form element description tried to explain that this "title" will be used as "link text". "link text" is the proper, standards conforming term, and using this term will additionally make a patch for #378064: Description field missing in menu settings on node form easier, because that one would expose a "link title" or "link description" form element, which is visible for screen-readers, and when hovering a menu link.
3) The entire description for "Parent item" (the select contains both menus and menu links) was removed, because it tried to explain a in-depth technical detail of the menu system, which is the entirely wrong place to explain it.
4) "Optional." in the description for the "Weight" select has been removed, because the selection contains no optional value. (All links must have a weight.)
Comment #49
Aren Cambre CreditAttribution: Aren Cambre commentedThe description under Weight needs simplification. It's wordy and inconsistently describes positioning: "sink" vs. "positioned nearer the top."
Suggestion: Menu links with smaller weights sort before links with larger weights.
11 words vs 18 words
Comment #50
sunNow including tests.
Also changed the label back to "Menu link title" after discussion with Bojhan.
Also changed the description for "Weight" based on Aren Cambre's proposal, but slightly modified.
Comment #51
Bojhan CreditAttribution: Bojhan commentedLooks good, setting it to RTBC - time to fix this bug.
Comment #52
Shai CreditAttribution: Shai commented@sun @Bojhan,
This is lookin' really good.
best,
Shai
Comment #53
sunok, this one additionally fixes the vertical tab summary updating.
No other change.
Comment #54
yoroy CreditAttribution: yoroy commentedlet's have test bot do a double check :-)
Comment #55
sunComment #56
Shai CreditAttribution: Shai commentedI applied the patch in #53 to a fresh D7 HEAD. All three files applied cleanly. I tested on new nodes and on existing nodes. Everything is working, including the new change so that the Menu title link status in the "Menu Settings" verticle tab updates instantly when it is change on the right.
Perfect.
Comment #57
webchickWow, this patch is AWESOME! Now. All we need is a follow-up patch to provide an option to set the default value of this checkbox at admin/structure/types and set that to TRUE on Page and we'll kill the #1 WTF in all of Drupal! :D
Oh-so-gladly committed to HEAD!
Wonder if this is worth a changelog entry, along with the ability to specify which menus are allowed to be selected from?
Comment #58
seutje CreditAttribution: seutje commentedweirdness when changing the node title:
Result: The link title is updated, but the vertical tab title isn't.
Solution: Trigger 'formUpdated' after changing the value?
Comment #59
sunoh, I apparently did not look into form.js. Nice one! So let's also fix the other instance. ;)
Comment #60
Shai CreditAttribution: Shai commentedI tested #54. It applied cleanly to a fresh install of D7. Didn't break anything and provided fix as described. Note that I did the following test, which it passed:
* I made the Menu Link Title different from the node Title
* I then went and changed the node Title and this had NO effect on the Menu Link Text or the Menu Settings vertical tab information. (Which is good, right. If the user has customized the menu link title, we don't want editing of the Title to hijack the customized title.)
* Then I changed the Menu Link Title back to be exactly the same as the node title. I then changed the node title... and both the Menu Settings and the Menu Link Title responded and mirrored the title as I changed it.
Great work.
Re: #59. I at first thought that #59 would be cumulative, including the changes in #54. But when I applied #59 to a fresh D7 install, the changes described in #54 didn't happen. That's when I went back to a fresh install and applied #54. I'm not sure what #59 does, so even if I applied over the #54 patch, the only thing I would be able to report is if it applied cleanly and whether it appeared to break anything. I think I'll wait till I hear back from @sun regarding what new is in there.
Shai
Comment #61
Shai CreditAttribution: Shai commentedNote that when I wrote #54 that was from the patch title; it referred to @seutje's patch from message #58.
@seutje, if you were following @sun's convention you would have labeled the patch with a #58. @sun's clever convention uses the comment number; it doesn't attempt to create a sequential version number which is what you must have thought, "since the previous one was 53, then I'll name this 54."
Shai
Comment #62
sunuhm - so #59 didn't work? Did you clear your browser's cache?
Comment #63
Shai CreditAttribution: Shai commented@sun. Correct, it didn't work; it didn't do the changes described in the patch in comment #58. It applied cleanly. But no, I didn't clear my browser cache (but hadn't for any of these other tests that worked). I'll try again.
But to be clear, please confirm that #59 is cumulative. In other words, you added changes to comment #58 patch. And so I should apply #59 to a fresh HEAD install and see the changes described in comment #58.
Also, could you note what changes you made in #59.
Shai
Comment #64
seutje CreditAttribution: seutje commented@sun: Oh yea, that makes sense. How did I not see that, it's only 5 lines higher...
@Shai : I'm sorry, I was unfamiliar with sun's convention or this issue. I just traced back the commit that broke my other patch and wanted to avoid naming collision.
Yes, #59 is cumulative, it applies to a clean HEAD. All sun did was replace some traversing and a low-level event trigger with a high-level event trigger that didn't require any traversing. Less code and more global, and therefore more flexible I'd say. It allows anything else on the page to easily pick up on the change and act upon it.
Applying #59 and performing a hard refresh (ctrl+F5 in FF) made me unable to break expected behaviour.
Comment #65
Shai CreditAttribution: Shai commented@seutje @sun,
I applied #59 to a fresh Drupal install. It applied cleanly
All of the basics are working:
But it doesn't pass that test I created in #60 on #54 (which did pass for #54). In that test, the title field was able to regain control of the Menu link title (and mirrored in the Settings Tab) when the Title and menu link were made to be in synch again after the menu link title had been previously customized. What not passing means is that once the Menu Link Title has been customized, the Title field can never gain control of the menu link title again.
I actually don't think that is a problem. I thought it was a cool bonus when it worked, but not really important if it's harder to do with the cleaner coding.
Shai
Comment #67
sun.core CreditAttribution: sun.core commentedok, what remains is a bug, but that's not critical. We should fix it though ;)
Comment #68
dman CreditAttribution: dman commentedalexkb pointed out :
#711316: Auto Menu Title - Drupal 7 version
That this auto-populate appears to be broken currently.
I too can't see it working any more.
Both the
where the logic tries to decide whether there are titles to fill in fail - And looking at the DOM I can see why.
Did the #[thing]-wrapper divs go away at some point?
... and why are they even being looked for? Surely #ids of the actual input elements should be unique in the first case - filtering by wrapper Ids is probably redundant.
Does this js need revisiting?
This is a bigger bug than the one currently described above. This is true "doesn't work like it should" (anymore)
Comment #69
alexkb CreditAttribution: alexkb commentedIf we just target the id names in the menu.js? Have attached a patch, which seems to work ok.
Comment #70
dman CreditAttribution: dman commentedYep, That's what I think the patch should be. Just wondered what the theory was that put the wrapper selector there first - I may have been missing something.
I can confirm in preliminary test that this does indeed fix the problem!
Comment #71
sunWe need to merge in #59 into #69.
Comment #72
alexkb CreditAttribution: alexkb commentedOk, merged 59 & 69 changes into a patch (attached). Seems to work ok at my end. Thanks.
Comment #73
sun.core CreditAttribution: sun.core commentedBoth patches seem to have been tested, so let's get this sucker done! :)
Comment #74
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks!