Problem/Motivation
- When adding/editing a node, you can define a path (alias) for it (e.g.,
about-us
). In D8 HEAD, as in D7, you do this without a leading slash. - When adding/editing a Page Display for a View, you can define a path for it (e.g.,
admin/content/node
). In D8 HEAD, as in D7 Views, you do this without a leading slash. - In #2418017: Implement autocomplete UI for the link widget, the Link widget UI is changed such that when you then want to link to these paths in the value of a link field, you need to start with a leading slash. This is to disambiguate linking by path from linking by an autocompleted node title (node titles don't usually start with a slash).
- This might confuse users.
Proposed resolution
Option 1:
This isn't a problem: defining a path is different from linking to it, so no UX problem.
Option 2:
This is a problem, so change the node and View forms to require a leading slash as well.
Option 3:
This is a problem, so change the Link widget to not require a leading slash. Doing so would mean that the autocompletion would keep giving you choices you're not interested in, so we should usability test whether that is a bigger problem.
Remaining tasks
Either share anecdotal opinions or conduct a usability test to determine which option to proceed with.
Comments
Comment #1
dawehner...
Comment #2
xjmSo, in the Views UI, there are theoretically some places where we might some day want a link widget, but others (like defining the path for a page display itself) that can only ever be a path from user input. I.e. it's inventing a new path, not referencing an existing one. This latter case is true of path aliases for nodes as well.
I think option 2 has a few sub-cases:
/
in front of the actual field, which will also help the user understand what to put in the field, and append the slash during submit handling.Also, this slash-or-no-slash expectation for the link widget was considered the best solution UX-wise to support an autocompleted link to a thing (the far more usable option) while still allowing the entry of a specific path without the annoyance of the autocomplete getting in the way. (Edit: so IMO option 3 is not a good choice.) However, it already has a UX tradeoff there for being able to toggle between the autocomplete behavior and the other behavior. I think that being inconsistent or inexplicit about that expectation elsewhere in the UI is seriously confusing and WTFy. So based on that I think this is major.
Comment #3
xjmSeveral @todo referencing this issue have been added in #2426181: Add a Url::fromUserInput() wrapper method for generating URLs from user-entered paths.
Comment #4
xjmComment #5
yoroy CreditAttribution: yoroy at Wunder commentedSomething to potentially weave into the upcoming usability testing.
Comment #6
Mac_Weber CreditAttribution: Mac_Weber commentedThank you @xjm for pointing the sub-cases for option 2.
Whatever path we choose for fixing this issue should be consistent across the whole system.
This means that in the future other sub-systems or other contrib modules may also have the autocomplete implemented for input of a link OR title, and it makes sense that all these inputs behave in the same way.
The end user does not need to know the difference between defining a path and linking to a path. Then, option 1 is not a good choice.
Maybe this should be more than a patch, but a policy to encourage the use of leading slash and its validation when the input is path definition.
In this case where the input may be either a path definition of a link to a path it should have two validations. The first would check for the leading slash, the other would be responsible for linking to a valid and alre. The presence or not of the leading slash would indicate which validation should be run.
I have to assume I was really confused with the leading slash in front of the field. Maybe an input place holder would look better. Actually, I think just a help text with example linking to an existing title and an example defining a internal path would be even better. Do not add the leading slash as a field prefix, because it would be awkward when the user has to input the slash again for a path definition.
In summary:
/
as field prefix - it may be awkward if the user has to input the slash one more time/
to define a new oneComment #7
Mac_Weber CreditAttribution: Mac_Weber commentedMoving to Views, as we also need to discuss this issue there.
Comment #8
webchickI would tend to agree with #6. In the future, we could always add explore other niceties like auto-prepending "/" where it's missing in form submit on those fields where we always expect a path. Also agreed that putting a "/" visibly before the field just introduces inconsistency at a different point.
Comment #9
webchickComment #10
webchickUntagging, and demoting, since this didn't really come up in usability testing. The good news is most people figured out the fact that you could now type a title in the link field. Hooray. So hopefully this inconsistency will bite people less than I initially worried it would.
Comment #11
webchickLinking #2474471: Views page displays do not accept an integer as path as an example of a patch that has to do some dumb things to get around this issue.
Comment #12
benjy CreditAttribution: benjy at PreviousNext commentedThis just caught me out, i've just got used to enter /path everywhere, I feel that views should work the same way.
Comment #13
Bojhan CreditAttribution: Bojhan commentedComment #15
yoroy CreditAttribution: yoroy at Roy Scholten commentedI do stumble on this regularly, consistently.
Comment #16
dawehner@yoroy
So you actually vote for using a starting slash in views as well?
Comment #17
yoroy CreditAttribution: yoroy at Roy Scholten commentedWell what I notice is that I always forget to start with a leading slash. So I'd rather not have to think about adding it myself.
Comment #18
Bojhan CreditAttribution: Bojhan commented@yoroy yup, me too - thats also how I expect it to work.
Comment #19
dawehnerAs the issue summary says #2418017: Implement autocomplete UI for the link widget introduced this slash behaviour. If we come up with a way to keep the autocompletion sort of working, that would be great.
Comment #20
Wim Leers+1 for making the auto-complete forgiving, i.e. by making it auto-complete even without a leading slash. I think this would address the usability concerns.
-1 for making paths without a leading slash valid input. Was discussed at length in #2418017: Implement autocomplete UI for the link widget and elsewhere.
@yoroy and @Bojhan, don't you have this expectation because that's how it worked for the past 10 years? Having a leading slash makes more sense because that's how relative URLs work. That's what relative URLs are. Having a leading slash means this is a valid URL you can copy/paste anywhere in the site — including in your content — and have it work.
Comment #21
yoroy CreditAttribution: yoroy at Roy Scholten commentedI *know* what a relative path is, and still I always make this mistake. Typical example of the difference between how people expect things to work and how it really works under the hood :-)
Comment #22
Wim LeersBut isn't this (bad) muscle memory from Drupal 7, 6 and before?
Also, this is not "under the hood" IMO. This is literally moving away from a Drupalism.
Also:
Comment #23
dawehnerSo you basically argue for the current behaviour in HEAD, right?
Yeah I think there is no system out there where you have to start using a slash in menu links.
Comment #27
pingers CreditAttribution: pingers as a volunteer and at University of Adelaide commentedThis is pretty screwed up in the context of customizing an RSS feed.
I'm trying to use the following config for a views feed display.
Format: RSS Feed
Show: Fields
Mapping "Content: Path" field to the link field passes in "/path-to/node". Note the leading slash... which causes RssFields::render() to add second leading slash and thenUrl::fromUserInput() interprets "path-to" as the host name. Not sure how to work around it.
EDIT: Workaround I found was add an ID field, then a custom text field with "node/{{nid}}" in it... then the url gets replaced with the nice path alias. Good enough.
Comment #28
ao2 CreditAttribution: ao2 as a volunteer commentedAbout #27 see #2673980: RSS view with fields give wrong URL from path field.
Comment #31
catchBumping this to major bug and marking #3064119: Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("taxonomy_term") to generate a URL as duplicate - it's possible to create an unrecoverable view in the UI.
Comment #33
colanConsistency is one thing, but the other problem (at least in Views' Rewrite Results -> Output this field as a custom link) is that the help text doesn't specify whether there should be a slash or not. The form gets submitted in both cases, with no feedback for as to which form is correct. Is one invalid? There's no way to know. Users have to try both ways and see what happens.
If there were at least an example or guidance here, consistency would be secondary. At least folks would know what to enter in each particular field.
Comment #35
catchPretty sure this is a duplicate of #3065720: When creating a Page View in the wizard and setting a path with leading slash (/) the created View display ends up with a double-slash (//), so marking as such.