In the new Outside In experimental module the user should get a prompt that tells them they are now in edit mode.
The original design issue for this module such as #2762505: Introduce "outside in" quick edit pattern to core and #2732443: Finalize the behavior for triggering view/edit/build modes from the toolbar (and fix the "disappearing toolbar") call for something that looks more like a dialog with a standard close button.
Here is one of the examples from those issues:
The wording of this message will be discussed in separate issue: #2893350: Determine exact wording of "You are in edit mode." message when edit mode is enabled.
Comment | File | Size | Author |
---|---|---|---|
#78 | 2773601-77.patch | 5.38 KB | tedbow |
#78 | interdiff-76-77.txt | 1.22 KB | tedbow |
#76 | 2773601-76.patch | 4.16 KB | GrandmaGlassesRopeMan |
#67 | 2773601-67.patch | 7.86 KB | tedbow |
#67 | interdiff-65-67.txt | 7.25 KB | tedbow |
Comments
Comment #3
xjmComment #4
tkoleary CreditAttribution: tkoleary at Acquia commentedIs it possible to make this part of a tour that is toggled on by default?
Comment #5
naveenvalechaComment #6
SKAUGHTa
Comment #7
tkoleary CreditAttribution: tkoleary at Acquia commentedAs an MVP for this patch could we simply create a status message for this?
Comment #8
tedbowOk here is patch that adds the message. I think will probably want to change the actual message to describe what it is.
I put a todo about refactoring once #77245: Provide a common API for displaying JavaScript messages is committed.
Right now if you click the message it disappears. This is inline JS which I imagine should be changed.
I wasn't sure how to insert it with unknow page markup so I used before main-canvas.
This also includes a test to make sure the message appears and is removed when leaving edit mode.
Comment #9
tedbowI added this extra check because displaying the message pointed out the on page load if already in Edit mode setEditMode would be called over and over again. Presumably this is every time a contextual link is added.
Comment #11
GrandmaGlassesRopeManRerolled the patch from #8.
Comment #12
GrandmaGlassesRopeManI'm not thrilled about having simple string represent complex functionality. Perhaps a better way to construct this and attach the event listener.
Comment #13
GrandmaGlassesRopeManComment #14
tedbow@drpal I want you to thrilled about this patch ;)
Moved to an event listener and not adding the element as a big string now.
Comment #15
GrandmaGlassesRopeMan+1 for vanilla js.
Do we need to call
drupal.debounce()
here since we're adding an element to the page? Additionallydrupal.annoucne()
for a11y?@tedbow PS. I am thrilled.
U+1F609
Comment #16
tedbowOk add anounce() and debounce()
I am not sure how we handle adding the correct css.
Also if you are scrolled down on the page you won't see the message.
Comment #18
tedbowI think we should postpone this on #77245: Provide a common API for displaying JavaScript messages
It doesn't make sense to do this twice.
Comment #19
tedbowOk #77245: Provide a common API for displaying JavaScript messages may or may not be committed by the time 8.4.0 comes out.
We can add this here and then refactor if needed.
This mostly a re-roll of #16 plus
Comment #20
GrandmaGlassesRopeManDepending on what other Drupal properties we're using, this might be an opportunity for destructing.
This could use some additional documentation.
Extra space before the
,
. Did eslint not pick this up?Cache this result of this selector possibly?
Comment #21
tedbow1. Adding destructing on Drupal announce, ajax, debounce, toolbar, behaviors, attachBehaviors(), t() are used.
2. add more comments
3. Yes eslint picked this up. fixed
4. This selector is only used once. It is called multiple times if the user goes in and out of edit mode. but the message element will be different because is created each time.
Also I had to explicitly add
toolbar/toolbar
as a dependency to the outside_in library not sure if this has to do with destructing.UPDATE: figured out why destructing JS change probably cause an error unless a dependency was added for toolbar/toolbar for the oustide_in library.
Since without destructing we didn't pass in Drupal.toolbar explicitly we just passed in Drupal and referenced Drupal.toolbar later, at the time the file loaded the toolbar property didn't have to be on the Drupal object. It only had to be there later when edit mode was invoked. So if toolbar.js was loaded later that would still work.
Using destructing Drupal.toolbar needs to be defined before the file is loaded so toolbar.js must be loaded first.
really toolbar/toolbar should have always been a dependency of oustide_in library but we just never noticed before.
So the really we should dependencies on drupal.announce and drupal.debounce also.
Comment #22
GrandmaGlassesRopeManSpaces around,
{}
.No new line.
Comment #23
tedbow1. Fixed
2. Fixed
Also had needed dependencies to drupal.outside_in. They should have already been there but didn't notice until similar problem found in #21
Comment #24
GrandmaGlassesRopeManThis introduces a new pattern of destructing the
Drupal
object. 👍Comment #25
droplet CreditAttribution: droplet commentedWe couldn't alias Drupal.t because it can't parsed by PHP.
Indirect issue but it tells how Drupal.t works in JS:
#2889600: [regression] Restore \LocaleJavascriptTranslationTest test coverage and keep testing processed JS file
In short word:
PHP matches
Drupal.t
@see \_locale_parse_js_file
Comment #26
tedbow@droplet thanks for the information. I definitely would never have thought of that.
So this patch doesn't alias Drupal.t.
But this results in
})(jQuery, Drupal, Drupal);
Which looks strange, but it does allow use to do destructiing.
As a follow up I think any Javascript function that doesn't allow aliasing because of something like this should have that clearly documented in the JSDoc. I looked at the JSDoc for Drupal.t and there is no way you would ever figure this out without looking at PHP code.
Comment #27
droplet CreditAttribution: droplet commentedPassing the variable isn't a must. We can drop it.
I think we should make it Drupal.theme
and use prefix with `.js-` so that will not removed by themer..etc
This doesn't debounced I think. If you calling setEditModeState, it's either skipped or redefined. (with or without it, no diff)
You could see the problem by:
Actually, you only need to add a condition, eg:
BTW, I can't imagine a use case you will call it twice in a short time
Comment #28
droplet CreditAttribution: droplet commentedAlso, I think to click the message to hide it isn't quite good. They will think it's exit editing.
And there's a big toolbar with large White Spacing on the right. Can't put it over there?
If it's a static message, I will add few more words. e.g.:
You are now in edit mode. <button> Exit it </button>
Comment #29
tedbowOk removing passing in Drupal twice.
#27.2
I added this check
So the displayEditMessage() won't try to display the method if it is already shown.
Removed dependence on debounce.
RE #27.1 and #28
I look back at the original design issue for this module such as #2762505: Introduce "outside in" quick edit pattern to core and #2732443: Finalize the behavior for triggering view/edit/build modes from the toolbar (and fix the "disappearing toolbar")
The designs call for something that looks more like a dialog with a standard close button.
Here is one of the examples from those issues:
So have changed this to use Drupal.dialog.
So
Because we using Drupal.dialog this not longer applies
I think this takes of #28 because we much closer to the original designs that were user tested this way.
Comment #30
droplet CreditAttribution: droplet commentedAhh. You using a secret version. haha. The GIF behavior diff to patch. If I using it frequently, it's a bit annoying.
Needs to remove it
Comment #32
tedbowSorry updated the issue summary.
1. Removed dependency on core/drupal.debounce
2. The tests in #29 failed because now that we are using a dialog it may be in front of other elements that the test is trying to interact with.
I added \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest::closeMessageDialog(). This closes the dialog whenever edit mode is enabled explicitly or when a block for is opened which also may enable edit mode if it is not already enabled.
I added waitForElementVisible() for this to be sure the element was actually displayed before clicking
I also added a waitForNoElement because it could cause random failures on drupalCI if this still in process of being removed before the test proceeds.
3. add CSS to make the dialog appear more like the designs by remove the border and background color for the title bar.
4. We to figure if we need the second part of the message or if we can do that in a follow up.
Comment #33
tedbowOk I added longer message from the original designs. I would rather not debate the text of the this message right now because that is more of UX issue and this issue still needs to figure out the technical aspect of displaying the message first.
I do think we will need a longer message that describes what edit mode is. We can figure out the exact text after we figure out the technical aspects.
But having the longer message allows use to get rid of the special styles for this dialog because we have a title and a message.
Here is screenshot:
Comment #34
tedbowCreate #2893350: Determine exact wording of "You are in edit mode." message when edit mode is enabled. to picking wording
Comment #35
GrandmaGlassesRopeManCan we add some documentation about why the rest of these values can be assigned with destructing but
Drupal.t
cannot?Comment #36
tedbow@drpal I feel we should add a comment instead to every function we cannot alias: #2893358: Add documentation Drupal.t() and other JS functions that cannot be aliased because they are scanned for in PHP
Comment #37
droplet CreditAttribution: droplet commentedI'm thinking of another way to handle it. Doc it still increasing of review workloads.
#2893361: Aliasing of `Drupal.t` and `Drupal.formatPlural` in JS
Comment #38
tedbowOk adding comment asked for #35 which includes a @todo point to #2893358: Add documentation Drupal.t() and other JS functions that cannot be aliased because they are scanned for in PHP
I don't think we need to wait on that issue though.
Comment #39
tedbowMade a type in that comment. Also a @see to the function that scans for Drupal.t
Comment #41
yoroy CreditAttribution: yoroy at Roy Scholten commentedIs this a custom solution for only edit mode? I ask because I have designs that make it more specific to this situation:
Current proposal with a title and a message seems a bit much, especially when there's empty space next to the "Editing" button:
Could we use that empty space in the toolbar?
Alternatively, what about stripping the current application down to its bare essentials:
Comment #42
tedbow@yoroy the current patch uses the standard Drupal dialog system(as does the tray itself) so it is not a custom solution in that sense. It is just positioned differently
The problem I see with that is that we are not sure what might be placed in the toolbar in edit mode in the future. Currently it the Place Button remains in the toolbar. There maybe other other things in the future that would go in the toolbar that only show up in edit mode.
I like this last approach.
The patch in #26 and above was taking similar approach before we started to use the dialog system.
Comment #43
yoroy CreditAttribution: yoroy at Roy Scholten commentedOk, so lets not over-optimize right now and see how we can tweak the design of the default dialog implementation (and not put the message inside the toolbar).
Comment #44
tedbowOk here is a patch that used the dialog system but does not have a special title section
I started from patch #32.
Then added:
Comment #45
yoroy CreditAttribution: yoroy at Roy Scholten commentedDuring today's UX meeting Gabor very rightfully pointed out that we already have two quite different ways of showing messages/functionality in a similar space:
Lets look into standardizing the look and feel of these instead of introducing yet another version. Either way, the single line of text in a dismissable dialog that's tucked closely under the toolbar is a good step in the right direction.
(We also discussed that a automatically disappearing message (after x seconds) could be useful here, which would be an interesting addition to the standard dialog capailities but that's out of scope for this specific issue.)
Comment #46
tedbowOk @drpal reminded me that once #77245: Provide a common API for displaying JavaScript messages lands we will just be to do something like
Drupal.message('#top-message-aread').add('You are in edit mode');
So once we have a common way to output display message via JS then this look like any other message on the site.
We the could a dismissable behaviour to all our messages whether they come the server or JS. So we could add something like
Drupal.message('#top-message-aread').add('You are in edit mode', {dismissable: true);
The point is that the solution here likely will improved and standardized using #77245.
We already have an existing @todo point to this issue in the patch!
So I think our current patch is good then?
Comment #47
GrandmaGlassesRopeMan🚀🚀
Comment #48
yoroy CreditAttribution: yoroy at Roy Scholten commentedSorry, I still want to be pragmatic here, but we're also trying to actually stabilize things. I think that also means we should be intentional about how things look. Especially with 2 related designs in place (#45) we should not introduce yet another styling, even if only temporary. We're stabilizing *now* and I'm reluctant to make finessing this dependent on an 11 year issue making it in before 8.4.
So I had a stab at styling the dialog message similar to the "exit block region demonstration" tab underneath the toolbar:
I took a screenshot of the CSS I hacked into it via Firebug :)
This is likely a messy fix code-wise but for the actual appearance I think it would be an improvement. Thoughts? Reasonable doable?
Comment #49
droplet CreditAttribution: droplet commentedI actually have few questions:
- Will this message improve the UX?
- What if we changing "Editing" to "< Exit Edit Mode" (we already have this style in admin section)
- What does user think about of the Close icon? Close this message Or Exit Edit Mode.
Comment #50
tedbow@droplet
- Yes, I think the message will improve UX but probably a different message like "Click a page element to edit it." that is why I created #2893350: Determine exact wording of "You are in edit mode." message when edit mode is enabled.. I think if we try to do both the JS implementation and wording in the same issue will never come to an agreement 😜
- I think "Exit Edit Mode" might be a good idea but I think that would in addition to wording that explain what the user should to in edit mode via ^^. So I think this should be a separate issue if we want to change the "Editing" text in the toolbar
- I think it is common pattern on the web to inform the user of something with a dialog and allow them to dismiss the message. I don't think the user expect dismissing the message would reverse what the message informed them of.
@yoroy
While agree we don't want to introduce a new styling without reason I don't know that copying the Exit link on the Block demonstration page is the best solution. Is this page actually used much?
The UX study #2497361: [meta] Fix issues found during UMN Usability Testing 2015 found
(#2514150: Advertise the block region demonstration in a more prominent way was opened to solve this but I was surprised to find was closed because Block Place "solves" the demo regions problem)
The fact is the styling provided by the block module for this probably only looks good in bartik. No core theme actually override the styles for the class .block-demo-backlink
Doing a quick google search tells me not many contrib theme actually took the time to style this.
Even if contrib or custom themes did style this because the block module uses a very specific class, .block-demo-backlink, our use would not get the same styling.
So we would either have to:
The fact is right now because #77245: Provide a common API for displaying JavaScript messages we have no common styling for messsage that appear after the user is already on the page because there is common way to do this. The only place I can think of is when you have unsaved changes in form you get a message style warning.
Here are a couple ideas to not introduced a new styling.
Idea #1: Dialog approach
Make this message look more like a standard dialog. Then we are using that a styling that already exists. I have attached patch that does this.
Here is what it looks like:
This is just using our standard dialog but with only the title bar showing, only the positioning has changed. One advantage of this method is that front-end themes will already styled modals/dialogs so we should just pick up the styles that they apply to dialogs and will get a more uniform look.
Here is the same dialog but with the page in narrower width.
You will notice that dialog actually because wider. But again this is because we are using the standard dialog and whatever styles are applied to dialogs will be picked up.
In this way we are not introducing a new styling.
Idea #2: Messages approach
Revert back to the idea in patch #26
This uses existing messages styles but does put them in new place.
If we went this way we would probably want to add a new "X" for closing the message.
Comment #52
tedbowForgot to update the test coverage.
Comment #53
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedRemind myself to look at accessibility of this in detail.
Skim-reading the patch, it looks like it's making good use of Drupal.announce().
Also, I really like that the message appears in physical proximity to the edit button. That's good for people using screen magnifier AT, much less risk of it appearing outside their viewport.
Comment #54
Wim LeersI think both this issue and #2889747: Determine if elements should be removed from the toolbar during edit mode. can be solved by making it far more visually clear that this is a mode with limited capabilities. If there were a visual (color) connection between the "Editing" tab in the top left and the blocks you can actually click to edit, this problem would go away.
Regardless of what you think of my proposal, these issues are closely related.
Comment #56
tedbowChanging to new settings_tray.module component. @drpal thanks for script help!
Comment #57
tedbowNeeds reroll at least for changes in #2803375: Rename Outside-in module to "Settings Tray" for real
Comment #58
jofitz CreditAttribution: jofitz at ComputerMinds commentedRe-rolled.
Comment #60
jofitz CreditAttribution: jofitz at ComputerMinds commentedAdd missed correction of class from "outside-edit-message" to "settings-tray-edit-message".
Comment #61
tedbow@Jo Fitzgerald thanks for the re-roll!
re @Wim Leers' idea about
I do think this an interesting idea but also don't want to just abandon the what was test in UX mockup before module code was ever written. I am not sure but I think we should go back to UX folks/meeting if we want to change something like this. Interested in what @yoroy thinks about this.
So as the patch stands now we are using the dialog system as described in #50. We just need sign off that this is correct way to go to mark this RTBC. In #47 @drpal marked this as RTBC. So I think we are good Javascript wise. In #49 @droplet had some concerns but no problems noted with the code.
In #48 @yoroy raised
I now don't think we are introducing new styling as detailed in #50
there were a couple UX concerned raised by @droplet in #49 and @Wim Leers in #50.
Both these are diverging from the UX that was actually tested in mockup with users before this module was written. I don't think we should be doing this in individual issues in the SEttings Tray modules. I think we should implement the UX that was tested.
I think if we are going to change the UX we should do it only after implementing the original UX and seeing that there is something wrong with it from actual users.
Couple remaining things on the patch. Uploading a another patch with these.
This change should be have been made to
settings_tray.es6.js
and then the file should have been built as described here: https://www.drupal.org/node/2815083Need to update click event.
The comment just got moved to after the last line.
Comment #62
tedbowI updated the edit message to "Click a page element to edit it." because that is what was determined in #2893350: Determine exact wording of "You are in edit mode." message when edit mode is enabled.
Comment #63
tedbowJust re-rolled this patch
Comment #64
GrandmaGlassesRopeManArrow function here. Additionally
attachBehaviors
is declared, but never used.We probably want to document that this returns early if there are no items returned.
Missing semicolon.
We're destructing everything else from
Drupal
, why notdialog
?Comment #65
tedbow1. fixed
2. It returns early if the message div is already on the page. Added a comment before the return statement
3. fixed
4. using destructing now for Drupal.dialog
Comment #66
tim.plunkettThe main portion of this patch looks great!
Here are a couple things I noticed:
!important is a huge red flag. Is it really necessary here?
All of this is out-of-scope. They are great changes, but should be done in a dedicated issue. Confirmed with @drpal that it's okay to punt any ES6ification
Not sure if the standard differs from PHP, but if this weren't JS code I'd say the first line should be "Displays" and that the @todo should be wrapped to 80 characters.
One character short on the indent
Comment #67
tedbow1. Because jQuery UI Dialogs add inline CSS it is hard to override. Basically we have dialog that only has a title. So we want not to display the content area. I have changed this to use Javascript to set the CSS.
2. Glad to remove these extra changes!
3. change to "Displays" also wrapped at 80. The standard is under discussion at #2924755: Set max line length for JavaScript code comments to 80 (rather than 100)
4. Fixed
Comment #68
tim.plunkettThis looks great!
I see that there are new Drupal.announce() calls, which is good. But I'm not qualified to remove the "needs accessibility review" tag, so I won't RTBC it just yet.
But after that review, I think this is good to go.
Comment #69
tedbowFound a problem. I am not a keyboard navigation expert but...
The dialog we use for this is not tabbable. So you cannot close it via the keyboard.
This is because the Contextual module restrains tabbing to the contextual links and the toolbar via:
tabbingContext = Drupal.tabbingManager.constrain($('.contextual-toolbar-tab, .contextual'));
So we could add 'contextual' class to our dialog but that is a hack. Also the contextual module announces a message
So even if were to add our dialog into the tabbing context this message would be wrong.
Comment #70
Wim LeersDrive-by review:
Channeling @nod_: why not use
document.querySelector()
?Nit, for clarity: s/edit mode/"edit mode"/
Comment #71
tedbow#69 identifies problem with displaying the dialog message. To fix this we would need non-trivial to
contextual
module and probably toDrupal.tabbingManager
The problem with doing this is likely that if #77245: Provide a common API for displaying JavaScript messages was finished we would not be using a dialog at all for this message. So we would making changes to
contextual
for a temporary problem.I would propose that we postpone this issue on #77245 for these reasons:
Drupal.tabbingManager
Comment #72
tedbowPostponing based on #71
#77245: Provide a common API for displaying JavaScript messages just RTBC'ed
Comment #75
steinmb CreditAttribution: steinmb as a volunteer commented#77245 just got in. 12y after been created :)
Comment #76
GrandmaGlassesRopeMan- refactor from #67 to use the messages api.
Comment #77
lauriiiWe probably want to add test coverage for this.
Comment #78
tedbow@drpal thanks for the updated patch!
@lauriii yep!
Here is an update to the test to assert the message appears and is removed when exiting edit mode.
Comment #79
lauriiiI don't think we need a separate accessibility review since this is leveraging the pre-existing message API. Test coverage has been also added in #78.
I tested this manually with Umami and it seems to work as expected. Also, the patch looks good for me.
Comment #81
xjmCan we get the current screenshots in the IS? Maybe even one of Bartik/Seven and one in Umami. :)
Also we haven't had a UX review in a long time, so we should probably get that too once the screenshots are available.
Comment #91
mgiffordTagging for https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html