WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#31655 closed defect (bug) (fixed)

Cmd+S needs to work in text view of post editor

Reported by: krogsgard Owned by: azaozz
Milestone: 4.3 Priority: normal
Severity: normal Version:
Component: Editor Keywords: ux-feedback
Focuses: ui, accessibility, javascript Cc:

Description

Cmd/Control+S works in the visual editor, but not the text view of the WordPress post editor. It should work in either. If you do cmd+S in text view, it prompts to save a file. This is not preferred.

Attachments (1)

31655.patch (2.5 KB) - added by azaozz 4 years ago.

Download all attachments as: .zip

Change History (18)

#1 @valendesigns
5 years ago

I can't save in Visual or Text mode with Command+S, both prompt a file save. What browser are you using? I tested in Chrome, Safari, and Firefox running OSX.

#2 @iseulde
4 years ago

  • Focuses javascript added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version 4.1 deleted

#3 @voilamedia
4 years ago

Where in core is this handled? i may be able to patch

#4 @voilamedia
4 years ago

  • Keywords dev-feedback added

Something like this should work

document.addEventListener("keydown", function(e) {
  if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
    e.preventDefault();
    // Process save
  }
}, false);

i believe this should fix things.. but seeing the core uses keypress i cant seem to be able to find where the save is being made in the admin js files. Can someone point me to the file and line number where this is being done.

This ticket was mentioned in Slack in #core-editor by iseulde. View the logs.


4 years ago

This ticket was mentioned in Slack in #core by azaozz. View the logs.


4 years ago

#7 follow-up: @iseulde
4 years ago

I wonder if the user will then expect everything on the page to save. At the moment your cursor needs to be in the visual editor to use it and it will only save the main fields. Should it work for the whole page, or only when the cursor is in one of the editors?

#8 @azaozz
4 years ago

Thinking this should work the same as in the Visual editor, i.e. run autosave when the textarea is in focus.

Can enhance it to include other content after we decide what we are going to do for #7756. If we go with:

$form.attr( 'target', 'some-hidden-iframe' ).submit().attr( 'target', '' );

we wouldn't need anything more.

Last edited 4 years ago by azaozz (previous) (diff)

@azaozz
4 years ago

#9 @azaozz
4 years ago

  • Keywords has-patch added; needs-patch dev-feedback removed

#10 @azaozz
4 years ago

  • Milestone changed from Future Release to 4.3

This ticket was mentioned in Slack in #core by obenland. View the logs.


4 years ago

#12 @azaozz
4 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 32680:

Editor: run autosave when pressing Ctrl or Command + S in the Text editor, same as the Visual editor.
Fixes #31655.

#13 in reply to: ↑ 7 ; follow-up: @johnbillion
4 years ago

  • Focuses accessibility added
  • Keywords ux-feedback added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to iseulde:

I wonder if the user will then expect everything on the page to save. At the moment your cursor needs to be in the visual editor to use it and it will only save the main fields. Should it work for the whole page, or only when the cursor is in one of the editors?

This is a concern. There's no reason for this only to trigger while focus is in the editor, and performing an autosave isn't what I'd expect from cmd+S (although #7756 would address this in the longer term).

TIL that cmd/ctrl+S was quietly introduced for autosave in the editor back in #24067.

cmd+S should perform a complete save, and should trigger regardless of where the focus is on the page.

Tagging accessibility because I know that custom keyboard shortcuts potentially have an accessibility impact.

#14 in reply to: ↑ 13 ; follow-up: @helen
4 years ago

Replying to johnbillion:

cmd+S should perform a complete save, and should trigger regardless of where the focus is on the page.

You want cmd+s to trigger a full page reload? I still press cmd+s compulsively even though it's not 1998 anymore, surely I can't be the only one. Having it go full-page-reload would drive me to tears, and curious what it would do for a published post, then.

#15 in reply to: ↑ 14 @Kelderic
4 years ago

Replying to helen:

Replying to johnbillion:

cmd+S should perform a complete save, and should trigger regardless of where the focus is on the page.

You want cmd+s to trigger a full page reload? I still press cmd+s compulsively even though it's not 1998 anymore, surely I can't be the only one. Having it go full-page-reload would drive me to tears, and curious what it would do for a published post, then.

It should probably be dependent on #7756. Once we've changed to saving without a page reload, it won't be so intrusive to the user.

#16 @obenland
4 years ago

@azaozz, what do you want to do here? Revert and wait for #7756? Or close and create a new ticket for a complete save once #7756 is in?

#17 @azaozz
4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Yeah, thinking this is done for now. It works exactly the same in both Text and Visual editors: the editor area has to have focus, and we do an autosave.

Best is to revisit it (in a new ticket) after #7756.

Note: See TracTickets for help on using tickets.