Archives block Drop-down issue#70508
Conversation
…script for selection redirection
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @shubhtoy! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @bemdesign-er, @mapk. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What?
Closes #13771
Fix Archives block dropdown functionality by making it interactive in the editor and functional on the frontend, aligning with the Category block behavior.
Why?
The Archives block's "Display as Drop-down" option was not working properly. When users selected this option, the dropdown was rendered but was disabled and non-functional. This created a poor user experience and accessibility issues, as the dropdown appeared to be broken rather than clearly indicating its disabled state.
As discussed in issue #13771, the ideal solution is to make archive blocks work like category blocks - being both accessible and using the same interaction patterns for consistency across the editor.
How?
The implementation includes two main changes:
Editor Changes (
packages/block-library/src/archives/edit.js):Disabledwrapper around theServerSideRendercomponentDisabledimportFrontend Changes (
packages/block-library/src/archives/index.php):onchangeattribute from the select elementbuild_dropdown_script_block_core_archives()that generates proper JavaScript for dropdown functionalitywp_get_inline_script_tag()for proper script injection following WordPress standardsTesting Instructions
Screenshots or screencast
The dropdown now functions consistently between editor and frontend, matching the Category block behavior for improved user experience
Before
Screen.Recording.2025-06-24.at.2.49.55.PM.mov
After
Screen.Recording.2025-06-24.at.2.53.20.PM.mov