Wp-calypso: Tags written in CAPS override tags written with regular capitalization

Created on 5 Apr 2017  Â·  3Comments  Â·  Source: Automattic/wp-calypso

Steps to reproduce

  1. Go to any Calypso visual editor on any site
  2. Add a lower case tag i.e 'test'. Save.
  3. Add Uppercase version of tag i.e 'TEST', remove lowercase 'test' tag. Save.
  4. Click out of editor to another screen such as the posts page. Prompt says 'You have unsaved changes, would you like to leave this page?' Click Yes.
  5. Return to editor
  6. The second, uppercase, instance of the tag is not saved, only the original lowercase 'test' tag is.

What I expected

I expected the removed tag to be replaced with the new tag.

What happened instead

The initial tag is not replaced, but instead persists. This can cause issues if a user wishes to correct the casing of the tag.

Browser / OS version

Chrome / Windows 10

Screenshot / Video

test_one
test_two

The issue also happens if you do not remove the first tag and just have two tags, same word, just different casings.

Context / Source

A user had 'CHICKEN' as their category, but wanted it to be 'Chicken'. So they replaced the tag and clicked save. The 'CHICKEN' tag was not replaced.

Chat: 287573-chat

Thoughts:

It appears that the tags share the same slug, so this conflict may be what is causing the second instances of the tag to not be saved. There is also the prompt box that pops up after 'saving' the second instance of the tag. This prompt box leads me to believe that the saving feature is not finishing because of the conflicting tags.

Editor OSS Citizen [Type] Bug

Most helpful comment

Editing a tag _is_ possible, just the editor (as a consumer of tags) doesn't do that. To edit the capitalization of a tag one has to go to the tag management (Settings → Writing → Tags).

That said:

I expected the removed tag to be replaced with the new tag.

This expectation is interesting to evaluate: technically the original tag wasn't edited, but a tag with the same letters in uppercase state was added. It's hard to infer user intent from that as it's not an explicit edit functionality.

Even more importantly: one shouldn't be required to type the tag capitalization correctly every time. If it's correct, the editor is meant to correct it to use the already existing form. It's just sensible. Imagine that a user once mis-types the capitalization and suddenly gets all the tags renamed. It's not a good experience.


Design Proposal

The editor _should_ be aware of that auto-correction, and _should_ auto-correct it, so the uppercase form should never show up, nor a duplicate form.

This is the design direction I'd advise to go for:

  1. If an existing tag is added, the Editor should correct it to be with the right capitalization (the one stored in the DB).
  2. The editor should not add again a tag already added if it has different capitalization (should happen automatically if the first point above is addressed, as currently re-typing a tag with the same capitalization doesn't get added).
  3. We should provide a link to the management section so one could go and edit tags from the Editor.
  4. (detail) The dirty state of the post shouldn't change if the user tries to add a tag with a different capitalization and gets auto-corrected.

All 3 comments

Not sure if this still applies, but the same issue was closed several years ago in the WordPress project:

Term slugs are canonical by design. This is a side-affect of that. Unfortunately, fixing this requires substantial redesign.

—Source: https://core.trac.wordpress.org/ticket/12191

Also possibly related: #5286

Editing a tag _is_ possible, just the editor (as a consumer of tags) doesn't do that. To edit the capitalization of a tag one has to go to the tag management (Settings → Writing → Tags).

That said:

I expected the removed tag to be replaced with the new tag.

This expectation is interesting to evaluate: technically the original tag wasn't edited, but a tag with the same letters in uppercase state was added. It's hard to infer user intent from that as it's not an explicit edit functionality.

Even more importantly: one shouldn't be required to type the tag capitalization correctly every time. If it's correct, the editor is meant to correct it to use the already existing form. It's just sensible. Imagine that a user once mis-types the capitalization and suddenly gets all the tags renamed. It's not a good experience.


Design Proposal

The editor _should_ be aware of that auto-correction, and _should_ auto-correct it, so the uppercase form should never show up, nor a duplicate form.

This is the design direction I'd advise to go for:

  1. If an existing tag is added, the Editor should correct it to be with the right capitalization (the one stored in the DB).
  2. The editor should not add again a tag already added if it has different capitalization (should happen automatically if the first point above is addressed, as currently re-typing a tag with the same capitalization doesn't get added).
  3. We should provide a link to the management section so one could go and edit tags from the Editor.
  4. (detail) The dirty state of the post shouldn't change if the user tries to add a tag with a different capitalization and gets auto-corrected.

I am closing this as the classic editor in calypso is being deprecated in favor of the block editor. If needed, please feel free to reopen.

Was this page helpful?
0 / 5 - 0 ratings