Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archives: Make the label above the dropdown editable #57613

Conversation

colinduwe
Copy link
Contributor

What?

Adds an editable label attribute to the Archives block that is displayed when "display as a dropdown" is selected.

Why?

#57528
Currently the dropdown is not editable.

How?

This initial commit puts the label textControl in the sidebar which is suboptimal. It should be directly editable.

Testing Instructions

  1. Open a post or page.
  2. Insert an archives block.
  3. Set to display as a dropdown and show label
  4. Set a custom label.
  5. Note that toggling the display as dropdown or show labels shows/hides the textControl for the label correctly.
  6. save post and confirm label is shown on the front end and the editor.

Testing Instructions for Keyboard

Similar to cursor, but confirm that tab controls correctly include the new textControl to set the label. The tab control works correctly when the textControl is removed when the display as dropdown is unchecked.

Screenshot 2024-01-05 at 2 12 47 PM
Copy link

github-actions bot commented Jan 5, 2024

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @colinduwe! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jan 5, 2024
@skorasaurus skorasaurus added the [Block] Archives Affects the Archives Block label Jan 12, 2024
@carolinan carolinan added the [Type] Enhancement A suggestion for improvement. label Jan 15, 2024
Copy link
Contributor

@carolinan carolinan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @colinduwe
Thank you for working on this enhancement.

The feature works well for me. Code wise, there is only the small coding standard issue with the spacing.

By making the label editable with a TextControl in the settings panel and not as a RichText, we avoid needing to change the disabled state of the block in the editor.

But we also loose the RichText features like making part of the text bold or use a different color. And we loose some consistency with other blocks that uses the RichText for the label, like the search block.

I am pinging the @WordPress/gutenberg-design team to ask for their feedback.

I will follow this closely because, no matter if we are editing the label in the canvas or in the inspector (the sidebar), I want the archives block and categories block to match.
Related: #56364

@carolinan carolinan added the Needs Design Feedback Needs general design feedback. label Jan 15, 2024
@jasmussen
Copy link
Contributor

The following is not a strong opinion so I can defer to others if need be.

Custom prefixes like these felt more appropriate for classic widgets, as there really was no convenient way to give them a title otherwise. In the block editor, in most cases, it's trivial to insert a paragraph or a heading before a particular block. In the case of inserting a heading, it is almost always going to be a better result when inserted manually, since it's important to get the heading level hierarchy right.

Separately, however, there have been some discussions around blocks that are more inline in nature, like next/prev buttons, etc, where a prefix or suffix can be more useful to have, rather than have to deal with row blocks. I vaguely recall some conversations around putting such prefixes and suffixes in the "advanced" section? Regardless of where that landed, it would be good to sync up with the result of that, so we don't create a UI that diverges from it.

@carolinan
Copy link
Contributor

carolinan commented Jan 15, 2024

The label is required because the select list is a form element.
The label is always present in the markup, but it has not been editable.
So even if the user kept the label visually hidden, they were unable to edit the label based on context.
For example, if the block was set to show a monthly archive, there was no way to use the label "Monthly archive".
There was no way to differentiate the blocks if multiple of them were placed together.

So adding a heading above it is not so helpful.

ndiego and others added 17 commits January 29, 2024 14:53
…lobal $wp_locale value in wp_default_packages_inline_scripts, which is where the date settings are set for inline JS. This change backports that from Core. (WordPress#58406)
* Widget Editor: Don't disable the Save button

* Update conditions
…8346)

* Site Editor: Hide export button if non-block-based theme

* Add e2e test
Just updating a few typos.
…rview sidebar (WordPress#57082)

* implement Tabs

* update styles

* fix tab flow and placement styles

* clean up DOM structure

* enable selectOnMove

* remove old css becuase i forgot in the last commit

* re-disable `selectOnMove`

* implement initialTabId value

* fix merge conflict errors

* incorporate post-rebase feedback

* classnames instead of roles

* fix horizontal scroll bar

* Update packages/editor/src/components/list-view-sidebar/index.js

Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com>

---------

Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com>
* Fix fonts modal dialog buttons accessibility.

* Reapply change after rebase.
* Fix translatable string in font library modal font card.

* Fix translatable string in font library modal local fonts.

* Simplify allowed font types string.

* Reapply change after rebase.
…ctices (WordPress#58196)

* Add context for the All translatable string and enforce l10n best practices.

* Fix typo.
…oked_blocks (WordPress#58378)

Co-authored-by: Bernie Reiter <96308+ockham@users.noreply.github.com>
)

* Update pattern block copy in light of pattern overrides

* Address copy review feedback
Copy link

github-actions bot commented Feb 7, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @gutenbergplugin.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core SVN

Core Committers: Use this line as a base for the props when committing in SVN:

Props ndiego, andrewserong, ramonopoly, richtabor, wildworks, aaronrobertshaw, shireling, ellatrix, afercia, tomjcafferkey, talldanwp, get_dave, tyxla, oandregal, carlosgprim, santosguillamot, jameskoster, jeherve, mmaattiiaass, aristath, mamaduka, cbravobernal, antonisme, andrewhayward, 0mirka00, glendaviesnz, andraganescu, antonvlasenko, fabiankaegy, youknowriad, gaambo, darerodz, grantmkin, jorgefilipecosta, derekblank, noisysocks, benniledl, jsnajdr, bartkalisz, desrosj, hellofromtonya, mikachan, poena, joen.

GitHub Merge commits

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: gutenbergplugin.

Co-authored-by: ndiego <ndiego@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: richtabor <richtabor@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>
Co-authored-by: chad1008 <shireling@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
Co-authored-by: afercia <afercia@git.wordpress.org>
Co-authored-by: tjcafferkey <tomjcafferkey@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: getdave <get_dave@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: fluiddot <carlosgprim@git.wordpress.org>
Co-authored-by: SantosGuillamot <santosguillamot@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: jeherve <jeherve@git.wordpress.org>
Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org>
Co-authored-by: aristath <aristath@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: antonis <antonisme@git.wordpress.org>
Co-authored-by: andrewhayward <andrewhayward@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: glendaviesnz <glendaviesnz@git.wordpress.org>
Co-authored-by: draganescu <andraganescu@git.wordpress.org>
Co-authored-by: anton-vlasenko <antonvlasenko@git.wordpress.org>
Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: gaambo <gaambo@git.wordpress.org>
Co-authored-by: DAreRodz <darerodz@git.wordpress.org>
Co-authored-by: creativecoder <grantmkin@git.wordpress.org>
Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Co-authored-by: derekblank <derekblank@git.wordpress.org>
Co-authored-by: noisysocks <noisysocks@git.wordpress.org>
Co-authored-by: at-benni <benniledl@git.wordpress.org>
Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>
Co-authored-by: WunderBart <bartkalisz@git.wordpress.org>
Co-authored-by: desrosj <desrosj@git.wordpress.org>
Co-authored-by: hellofromtonya <hellofromtonya@git.wordpress.org>
Co-authored-by: mikachan <mikachan@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@getdave
Copy link
Contributor

getdave commented Feb 8, 2024

Hi @colinduwe. Thank you very much for this PR.

It looks like you have quite a few files changed here which maybe due to merging rather than rebasing against trunk.

You can

  • pull the latest trunk
  • checkout this branch
  • rebase against trunk - git rebase trunk.

Then you can force push the branch to update.

@colinduwe
Copy link
Contributor Author

Yes, I'm not 100% clear what went awry when I rebased to apply this branch atop the current trunk. I'm going to close this and submit a new PR that isn't such a mess. Apologies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Archives Affects the Archives Block First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.