Skip to content

Conversation

@gonfunko
Copy link
Contributor

@gonfunko gonfunko commented Apr 14, 2025

The basics

The details

Resolves

Fixes part of RaspberryPiFoundation/blockly-samples#2482

Proposed Changes

This PR adds support for arbitrary HTML elements in the menu of a FieldDropdown. This is mostly to allow them in FieldGrid, which is a FieldDropdown subclass, but also gives developers greater flexibility. This PR does not attempt to ensure reasonable bounds or interaction behavior for HTML elements in menus; provided elements should not be unreasonably large or expect to handle mouse/keyboard interaction, but this is the responsibility of developers to ensure.

When an HTML-element-based menu item is selected, a text representation of the element will be displayed in the field. In order of preference, the text is derived from (1) the title attribute of the element, (2) the aria-label attribute of the element, and (3) the innerText of the element.

This PR also updates several tests that omitted various fields from the ImageProperties interface; the interface and documentation state that all 4 properties are required, but the implementation was a bit loose on that.

@gonfunko gonfunko requested a review from a team as a code owner April 14, 2025 18:42
@gonfunko gonfunko removed the request for review from sappm01 April 14, 2025 18:43
@rachel-fenichel
Copy link
Collaborator

@maribethb can you take a look at this one for me?

@maribethb maribethb requested review from maribethb and removed request for rachel-fenichel April 15, 2025 20:40
@gonfunko gonfunko merged commit fd9263a into RaspberryPiFoundation:rc/v12.0.0 Apr 15, 2025
7 checks passed
@gonfunko gonfunko deleted the html-menu-items branch April 15, 2025 21:34
@gonfunko gonfunko added the PR: feature Adds a feature label Apr 16, 2025
@github-actions github-actions bot added PR: feature Adds a feature and removed PR: feature Adds a feature labels Jul 21, 2025
@rpbourret
Copy link
Collaborator

This applies to issue 2482 in blockly-samples (Generalise what can appear as field-grid-dropdown items), not 2482 in blockly, as is stated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: feature Adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants