Skip to content

Conversation

@sirreal
Copy link
Member

@sirreal sirreal commented Dec 29, 2025

Proposed changes:

A list of popular languages are sorted at the top of the language dropdown (closes ARC-1306):

Before After
Screenshot 2026-01-02 at 17 40 04 Screenshot 2026-01-02 at 17 44 48

Ensure that the "show language name" option displays "Plain text" language name when selected (fixes ARC-1305):

Before After
(no language displayed) Screenshot 2026-01-02 at 17 45 23

Replace show filename toggle with filename input field (closes ARC-1307):

Before After
Screenshot 2026-01-02 at 17 39 37 Screenshot 2026-01-02 at 17 45 03

Improve line highlight color based on text color (closes ARC-1308):

Before After
Screenshot 2026-01-02 at 17 47 00 Screenshot 2026-01-02 at 17 45 39

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

pdtkmj-42c-p2#comment-8195
pdtkmj-42c-p2#comment-8230

Does this pull request change what data or activity we track or use?

No

Testing instructions:

Test out the modified functionality in the Code block and confirm it works as expected.

@sirreal sirreal added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress labels Dec 29, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (WordPress.com Site Helper), and enable the code-block/fixes-polish branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack-mu-wpcom-plugin code-block/fixes-polish

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@jp-launch-control
Copy link

jp-launch-control bot commented Dec 29, 2025

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/code/class-code-block.php 0/310 (0.00%) 0.00% 2 ❤️‍🩹

Full summary · PHP report

@sirreal sirreal force-pushed the code-block/fixes-polish branch 2 times, most recently from e6ebf3e to 0201616 Compare January 2, 2026 16:16
@sirreal sirreal marked this pull request as ready for review January 2, 2026 16:51
Copilot AI review requested due to automatic review settings January 2, 2026 16:51
@sirreal sirreal added [Status] Needs Review This PR is ready for review. Reviewer Can Merge PR author indicates the reviewer is free to merge/deploy if they want to own the change. and removed [Status] In Progress labels Jan 2, 2026
@sirreal sirreal requested a review from a team January 2, 2026 16:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the code block functionality with several UX improvements and fixes, including reorganizing the language dropdown to prioritize popular languages, ensuring "Plain text" displays correctly as a language name, replacing the filename toggle with a direct input field, and improving the active line highlight color using relative color syntax.

  • Sorted popular languages at the top of the language dropdown for easier access
  • Fixed display of "Plain text" language name when showLanguageName is enabled
  • Replaced filename toggle with direct filename input field in settings panel

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/code/editor.css Adds new active line highlight using oklch relative color syntax
projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/code/common/block.ts Removes deprecated showFileName attribute from interface
projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/code/class-code-block.php Removes showFileName attribute registration and updates rendering logic to always show filename when present, adds "Plain text" fallback for language display
projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/code/block-definition/block-definition.tsx Adds popular languages section to dropdown, replaces filename toggle with TextControl input, updates language display logic, and adds copy button click handler
projects/packages/jetpack-mu-wpcom/changelog/code-block-fixes-polish Documents the changes as a minor addition

Copilot AI review requested due to automatic review settings January 2, 2026 17:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

@sirreal sirreal force-pushed the code-block/fixes-polish branch from 2bc8833 to 2d6fc0f Compare January 2, 2026 17:23
Copilot AI review requested due to automatic review settings January 2, 2026 17:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/code/block-definition/block-definition.tsx:216

  • The toolbar dropdown menu should also display popular languages at the top, similar to the SelectControl in the sidebar. Currently, it only shows "Plain text" followed by all languages in alphabetical order, but doesn't include the popular languages section that was added to the sidebar dropdown.
									{ selectLanguageOptions.map( option => (
										<MenuItem
											key={ option.value }
											role="menuitemradio"
											isSelected={ option.value === props.attributes.language }
											onClick={ () => {
												props.setAttributes( {
													language: option.value,
													languageConfidence: 'certain',
												} );
												onClose();
											} }
										>
											{ option.label }
										</MenuItem>
									) ) }

cbravobernal
cbravobernal previously approved these changes Jan 5, 2026
Copy link
Contributor

@cbravobernal cbravobernal left a comment

Choose a reason for hiding this comment

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

LGTM

@sirreal sirreal force-pushed the code-block/fixes-polish branch from 5c2d9b1 to 5dc97d3 Compare January 5, 2026 11:26
@sirreal sirreal removed the [Status] Needs Review This PR is ready for review. label Jan 5, 2026
@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jan 5, 2026
Copilot AI review requested due to automatic review settings January 5, 2026 12:19
@sirreal sirreal added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Jan 5, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

</SelectControl>
<TextControl
label={ __( 'Filename', 'jetpack-mu-wpcom' ) }
defaultValue={ attributes.filename }
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

Using defaultValue instead of value for a controlled input means the component won't update when attributes.filename changes externally. This can lead to the displayed value being out of sync with the actual attribute value. Consider using value prop instead to make this a properly controlled component.

Suggested change
defaultValue={ attributes.filename }
value={ attributes.filename }

Copilot uses AI. Check for mistakes.
Comment on lines +190 to +195
isSelected={ emptyLanguageOption.value === props.attributes.language }
onClick={ () => {
props.setAttributes( {
language: emptyLanguageOption.value,
languageConfidence: 'certain',
} );
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The comparison emptyLanguageOption.value === props.attributes.language may not work correctly if props.attributes.language is undefined or null instead of an empty string. Consider using a more robust check like !props.attributes.language or explicitly checking for undefined/null values.

Suggested change
isSelected={ emptyLanguageOption.value === props.attributes.language }
onClick={ () => {
props.setAttributes( {
language: emptyLanguageOption.value,
languageConfidence: 'certain',
} );
isSelected={ ! props.attributes.language }
onClick={ () => {
props.setAttributes( {
language: emptyLanguageOption.value,
languageConfidence: 'certain',
} );

Copilot uses AI. Check for mistakes.
@sirreal sirreal merged commit 58f89c4 into trunk Jan 5, 2026
76 checks passed
@sirreal sirreal deleted the code-block/fixes-polish branch January 5, 2026 12:46
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[mu wpcom Feature] Wpcom Blocks [Package] Jetpack mu wpcom WordPress.com Features Reviewer Can Merge PR author indicates the reviewer is free to merge/deploy if they want to own the change. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants