Opened 12 years ago
Closed 11 years ago
#23697 closed task (blessed) (fixed)
Check and refresh post locks with heartbeat
Reported by: | azaozz | Owned by: | |
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Administration | Keywords: | autosave-redo has-patch |
Focuses: | Cc: |
Description
This will change the frequency we check post locks: 15 sec. when the user is active and 2 min. when inactive and add prominent warnings when somebody else is editing or when another user takes over.
Attachments (10)
Change History (50)
#2
@
12 years ago
- Cc graham.armfield@… added
Seen the image in the Daily Digest.
I know it's early days still, but just wanted to add in a couple of accessibility considerations.
If we're going to pop up a panel like that please can we ensure that keyboard focus is transferred into the panel when it opens - and given to some sensible Heading that describes what's going on. The text 'Other person is currently editing' could get it (consider tabindex=0, or tabindex=-1 if this item should not become permanently part of tab order).
Then the tab order should be sensible within the panel. Consider what should happen if user tabs beyond Go Back button, or before Take over button. Cycling tab within panel is OK.
When one of the buttons is pressed, the keyboard focus must be returned to somewhere sensible. Does clicking Go Back just close the panel? Should be made clear - in an accessible way.
Is it going to be obvious to users what happens if they click Take Over - including what'll happen to the other person who currently has control?
@
12 years ago
Previous patch from @azaozz plus generic dialog styles, modified messaging, and gravatars!
#3
@
12 years ago
23697-2.patch uses the changes from @azaozz's patch, plus:
- Generic Dialog/Notice Styles
- Default buttons displayed
- Slightly more friendly messaging
- Gravatars, so that you know whose post you're taking over (or who to go beat with Ted to give your lock back)
Screenshots of the takeover notice and after lock has been taken both attached.
#6
follow-up:
↓ 8
@
12 years ago
Good first pass. Based on a review:
I am not sure why we switched from AUTOSAVE_INTERVAL * 2 to 120, is this because "autosave" the concept is changing as we know it?
Please remember that get_option( 'show_avatars' ) should be checked.
Please do not use global $post_ID. [23661] should use the original $post = get_post();
Avatars may not be from gravatar.com, so the JS code should be removed. If we are going to do nasty things like parse the source URI out of get_avatar(), then we should also un-encode amp; there, not in JS.
Rather than sending back new_lock as a : separated piece of data, only to regex out a piece of it, can we send back structured data? As in, user ID + time?
Rather than <?php if ( ! $locked ) echo ' style="display:none"'; ?>>
could we use a class?
wp_trash_post() or wp_delete_post() is likely invoked in other situations where it may make sense to block it if the post is locked.
The post_lock_take_over filter (which should probably be post_lock_override or override_post_lock for clarity, even if "take over" ends up being the UI) should receive $post and $user, not just the IDs.
#7
@
12 years ago
Thanks for the review.
Since locks are not tied to autosave any more, using AUTOSAVE_INTERVAL * 2
may cause some problems if set to different value. With heartbeat locks are refreshed every 15 sec. when the user is active and every 120 sec. when inactive. We were discussing "taking over" immediately (without showing a notice) if the user that has the lock is inactive. Wanted to run some more tests before adding that.
Sure, will use get_post() and get_option( 'show_avatars' ) to shorten it there.
Rather than sending back new_lock as a : separated piece of data...
Sure. This is unused at the moment. It was sent in the old autosave response and can be used for lock monitoring in JS.
Rather than <?php if ( ! $locked ) echo ' style="display:none"'; ?>> could we use a class?
That can use the hidden
class. Having a style attribute there optimizes the jQuery(':hidden') check a bit for some browsers.
wp_trash_post() or wp_delete_post() is likely invoked in other situations where it may make sense to block it if the post is locked.
Yes, at least when bulk-trashing posts. This should have been in a separate ticket, will open one tomorrow.
Yeah, the names can be better :) Will switch to using $post and passing it to the filters.
#8
in reply to:
↑ 6
;
follow-up:
↓ 9
@
12 years ago
Replying to nacin:
Avatars may not be from gravatar.com, so the JS code should be removed. If we are going to do nasty things like parse the source URI out of get_avatar(), then we should also un-encode amp; there, not in JS.
Yes, that's needed for displaying avatars in the posts list table too. Was thinking to separate get_avatar()
into two functions, one to get the src and another to return the img tag. Then we can specify the encoding of &
, etc. easily.
The other part is harder. In JS it's not safe to pass the URL directly. Will look for another way.
#10
follow-up:
↓ 11
@
12 years ago
In [23725]:
Post locks: add Preview button when post is locked, fix the suggested places.
#13
in reply to:
↑ 11
;
follow-up:
↓ 14
@
12 years ago
Replying to grahamarmfield:
Added in [23733]. Is there anything else we should be doing to make these dialogs better?
#14
in reply to:
↑ 13
@
12 years ago
Replying to azaozz:
Replying to grahamarmfield:
Added in [23733]. Is there anything else we should be doing to make these dialogs better?
My take on accessibility best practices for these dialogs (and all popup panels) would be:
- When the dialog opens, keyboard focus must be transferred into a meaningful object within the dialog - suggest a heading that explains purpose of dialog. This item can be given tabindex=0 to allow it to receive focus both by scripting and tabbing.
- The purpose of the dialog should always be visible.
- Whilst the dialog is open, functionality will be needed to tidily cope with users tabbing beyond the controls/buttons in the dialog, or reverse tabbing before the entry point. Tabbing can either cycle within dialog if it's important that user responds, or that tabbing outside confines of dialog closes the dialog.
- Whenever dialog is closed, keyboard focus should be returned to somewhere sensible - maybe the link/button that opened dialog in the first place, or to top of a new page if one is opened.
Hope that helps.
#15
follow-up:
↓ 16
@
12 years ago
[23733] introduced odd visual focus glitches:
Chrome:
Firefox:
This item should get focus without a visible outline.
#16
in reply to:
↑ 15
;
follow-up:
↓ 17
@
12 years ago
Replying to markjaquith:
[23733] introduced odd visual focus glitches:
This item should get focus without a visible outline.
I'm afraid I disagree with that. In my view from an accessibility perspective, focus should always be visible wherever possible. By all means tone down the Chrome effect, but the Firefox formatting is fine.
#17
in reply to:
↑ 16
@
12 years ago
Replying to grahamarmfield:
focus should always be visible wherever possible
Even for a plain old paragraph of text? In this instance, that line of text artificially receives focus so it's getting the focus styling when it appears, which is visually ugly and distracting.
#18
@
12 years ago
[23733] introduced odd visual focus glitches... This item should get focus without a visible outline.
Wasn't sure what is the proper way here, so left out the outline: 0
for this commit.
As far as I understand focus should always be visible for normally focusable elements, i.e. form elements and links. For elements that normally don't receive focus, the outline visibility depends on the function: if the element is used as a link or a control (i.e. has onclick="some_action"
, etc.) the focus should be visible. If not, there is no need for the focus to be visible.
This sounds good except when the focus is "invisible" there is one more "tabbing stop" that is undetectable for most users (thinking screen readers would read the focused element's text). In our case pressing tab would go to the first button, pressing shift+tab would go back to the <p> and if there is no outline, sighted users that don't use a mouse will be left wondering where the focus is.
This can be avoided if we use tabindex="-1"
(the element is focusable only with JS) but then screen reader users would not be able to go back to the text...
The solution as I see it is to use tabindex="-1"
and focus it while containing the tabbing inside the dialog:
- When the dialog is opened, focus goes to the <p>.
- Tabbing moves through the buttons.
- When the next tab stop is outside the dialog, we move the focus to the <p> again.
#20
@
12 years ago
In 23697-3.patch: don't show "post locked" dialogs to superadmins that are not members of the blog or to the users when such superadmin has locked a post.
Needed when a superadmin troubleshoots issues on the Edit Post screen and the user opens the same post.
#22
@
12 years ago
In 23697-4.patch:
- Show "Saving revision..." while autosaving after a post lock has been taken over. Change to "Revision saved" when autosave completes.
- Make sure a user exists before using
$user->display_name
.
#23
@
12 years ago
I'm not convinced that 23697-3.patch is good default behavior. Rather, there should be a filter here to enable a user to silently look in.
But secondly, why can't read-only mode work?
#24
@
12 years ago
Yeah, we were discussing how to best to this. For superadmins that are not users on the blog best seems to have a button to "ignore" the lock. That will put them in a read-only mode. We still would need to show the "Post locked" or "Lock taken over" warnings so they are aware the user has the lock.
Also talked about "incognito" mode (something like 23697-3.patch) but that has the disadvantage of not knowing whether the user has opened the post and/or who has the lock. Will make a new patch soon.
#25
@
12 years ago
On 23697-4.patch:
What about "Saved as new revision" and bringing it down to the right of the button? It could be set in a smaller font size too to take up less space. That way it's clear what happened to the changes being made.
#26
@
12 years ago
What about "Saved as new revision" and bringing it down to the right of the button?
Was thinking the same but in some translations both the button and the text would be quite longer, and the line will wrap under the button making it look pretty bad.
#27
@
12 years ago
In [24042]
- Show 'Saving revision...' while autosaving after a post has been taken over. Change to 'Your latest changes were saved as a revision.' when autosave completes.
- Make sure a user exists before using $user->display_name.
- Add 'post_lock_text' action for extending the message text.
#28
@
12 years ago
In 23697-5.patch:
- Move nonces refreshing from autosave to lock checking.
- Do autosave only when there is something to save.
#29
@
12 years ago
In [24209]:
Post locks and autosave:
- Move nonces refreshing from autosave to lock checking.
- Do autosave only when there is something to save.
#31
@
12 years ago
It doesn't make sense to check post locks for single installs with only one user. Seems we should do that for multi-site installs too. Superadmins are able to edit or post to all blogs without being a user on the specific blog but that is an exception.
In 23697-6.patch:
- Change from IDs to classes for the
notification-dialog
divs so they can be reused. - Do not check post locks if the dialog's html is not present.
- Do not check post locks if there is only one blog user (for both single and multi-site installs).
#33
@
12 years ago
23697-7.patch is same as 6.patch except it always checks post locks on multisite.
#34
@
12 years ago
23697-7.patch looks good. This way we still have functioning lock notifications for sites with single user blogs + superadmins.
#36
@
12 years ago
In 23697-8.patch:
- When a post is locked, ensure the 'Go back' button doesn't reload the same screen. If the referrer is the same or there is no referrer, change the button from 'Go back' to 'Go to All Posts'/'Go to All Pages' etc. and load the proper post type screen.
- Rename 'wp-check-locked' to 'wp-check-locked-posts', it's clearer.
Initial patch:
To do: