Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#50499 closed enhancement (fixed)

Slug field should not autocorrect in Quick Edit view

Reported by: swb1192's profile swb1192 Owned by: peterwilsoncc's profile peterwilsoncc
Milestone: 5.9 Priority: normal
Severity: normal Version: 5.5
Component: Quick/Bulk Edit Keywords: has-patch has-testing-info commit
Focuses: Cc:

Description (last modified by afragen)

When using the Quick Edit view on a Posts admin page, autocorrect is enabled when editing the slug. This may result in the unintended slugs.

By using spellcheck="false" in the input field, browsers including Safari will no longer autocorrect or spell check the slug field.

Attachments (3)

0000.diff (646 bytes) - added by swb1192 4 years ago.
spellcheck disabled for slug field
50499.diff (670 bytes) - added by sabernhardt 3 years ago.
adding autocomplete="off"
Before_After_50499.diff.jpg (224.4 KB) - added by costdev 3 years ago.

Download all attachments as: .zip

Change History (29)

@swb1192
4 years ago

spellcheck disabled for slug field

#1 follow-up: @SergeyBiryukov
4 years ago

Hi there, welcome to WordPress Trac! Thanks for the ticket and the patch.

Just noting that per MDN web docs, spellcheck="false" appears to be the correct value to disable the check, rather than spellcheck="off".

#2 in reply to: ↑ 1 @swb1192
4 years ago

Replying to SergeyBiryukov:

Hi there, welcome to WordPress Trac! Thanks for the ticket and the patch.

Just noting that per MDN web docs, spellcheck="false" appears to be the correct value to disable the check, rather than spellcheck="off".

Thanks for catching that! I wrote "off" in the description erroneously, but the patch has the correct "false".

#3 @afragen
4 years ago

  • Description modified (diff)

#4 @SergeyBiryukov
4 years ago

  • Milestone changed from Awaiting Review to 5.8

Just noting that spellchecking was previously enabled for the post title field on Edit Post screen in classic editor, see [30350] / #30338. That appears to be the only instance of the spellcheck attribute in core at the moment.

This ticket suggests disabling it for the post slug field in Quick Edit on Posts screen.

I don't have a strong preference either way here, moving the the milestone for discussion.

Version 0, edited 4 years ago by SergeyBiryukov (next)

#5 @Clorith
3 years ago

Since slugs are by intent likely not going to pass a spell-check, since it's just a bunch of words combined into a long string, this seems like a reasonable enhancement to avoid minor confusion without any obvious drawbacks (especially considering WordPress will auto-generate the slug based on the title, which is what I suspect will be used in the majority of situations).

#6 @desrosj
3 years ago

  • Milestone changed from 5.8 to 5.9

Today is feature freeze day for 5.8.

I'd like to allow a bit more time in order to see a bit more feedback on this one before making the change, so I'm going to punt to 5.9.

#7 @swb1192
3 years ago

@desrosj What is the process of garnering more feedback?

#8 @swb1192
3 years ago

@desrosj How can I push for this to be in 5.9?

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


3 years ago

#10 follow-up: @JeffPaul
3 years ago

@swb1192 this seems like a worthwhile and reasonable enhancement (essentially concurring with @SergeyBiryukov's assessment). Are there any other places you know of that might also benefit from this same treatment? If not, then this seems good to go for 5.9 from my view.

#11 in reply to: ↑ 10 @swb1192
3 years ago

@JeffPaul Thanks Jeff - good point! This could also be added to the URL Slug/permalink field in the block editor. I can provide a diff for that too.

#12 @JeffPaul
3 years ago

@swb1192 that block editor change is probably best filed upstream at github.com/wordpress/gutenberg to get into the Gutenberg plugin and eventually back into core.

#13 @swb1192
3 years ago

@JeffPaul Ah, got it. I'll keep pushing for this to be in 5.9 then. Not sure how to get the right visibility of this ticket.

#14 @sabernhardt
3 years ago

GB33612 is open for discussion about the block editor field.

The spellcheck attribute can also be added to the Classic Editor, and I included it in my patch for fixing the missing label for that input on #53725.

#15 @sabernhardt
3 years ago

The merged PR 33708 adds both spellcheck="false" and autocomplete="off" in the block editor's slug field.

Should we disable autocomplete in Quick Edit, too? (It already was in Classic Editor since r34105.)

@sabernhardt
3 years ago

adding autocomplete="off"

#16 @sabernhardt
3 years ago

I added the autocomplete attribute for consistency with the other Slug inputs.

#17 @swb1192
3 years ago

@JeffPaul Hi! Does this look ready for being picked up in 5.9?

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


3 years ago

#19 @JeffPaul
3 years ago

  • Keywords needs-testing added

@swb1192 I've labeled the latest patch from @sabernhardt as needs-testing, but the upstream PR landed in Gutenberg 11.3 and will be part of the merge into core in the 5.9 release cycle.

#20 @Boniu91
3 years ago

  • Keywords has-testing-info added

This ticket was mentioned in Slack in #core-test by boniu91. View the logs.


3 years ago

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


3 years ago

#23 @costdev
3 years ago

  • Keywords needs-testing removed

Test Report

TL;DR

Patch is successful. Ready for commit.

Env

  • WordPress 5.9-alpha-20211109.232952
  • Chrome 95.0.4638.69
  • Windows 10
  • Theme: Twenty Twenty One
  • Gutenberg Editor
  • Plugins: None


Steps to test

  1. Navigate to Posts.
  2. Hover over a post and click Quick Edit.
  3. Right-click on the slug field and click Inspect (Element).
  4. The selected line should read:

<input type="text" name="post_name" value>

  1. Apply the patch.
  2. Repeat steps 1-3.
  3. The selected line should now read:

<input type="text" name="post_name" value autocomplete="off" spellcheck="false">

Additional testing

  1. Navigate to Posts.
  2. Hover over a post and click Quick Edit.
  3. Enter a new slug, spelled incorrectly.
  4. Click Update.
  5. Refresh.
  6. Hover over the same post and click Quick Edit.
  7. Empty its slug field.
  8. Type the first character of the slug you set in (3).

Before the patch, it should predict that you want the previous slug you typed.

  1. Apply the patch.
  2. Repeat steps 1-7.

After the patch, it shouldn't predict anything.

Results

  • Patch: 50499.diff
  • Before patch: The slug field does not have autocomplete set to off and spellcheck set to false. It autocompletes and autocorrects in browsers that support these features.
  • After patch: The slug field has autocomplete set to off and spellcheck set to false. It does not autocomplete or autocorrect in browsers that support these features.
Last edited 3 years ago by costdev (previous) (diff)

#24 @hellofromTonya
3 years ago

  • Keywords commit added

#25 @peterwilsoncc
3 years ago

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

In 52092:

Quick/Bulk Edit: Disable auto-correct for slugs.

Disable auto-correct for the slug field on the quick/bulk edit interface. As slugs may consist of a number of words combined in to a single string, they are unlikely to pass spell checkers.

Props swb1192, SergeyBiryukov, afragen, Clorith, desrosj, JeffPaul, sabernhardt, Boniu91, costdev, hellofromTonya.
Fixes #50499.

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


3 years ago

Note: See TracTickets for help on using tickets.