feat: Allow for HTML elements in dropdown field menus. #8889
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 inFieldGrid, which is aFieldDropdownsubclass, 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
titleattribute of the element, (2) thearia-labelattribute of the element, and (3) theinnerTextof the element.This PR also updates several tests that omitted various fields from the
ImagePropertiesinterface; the interface and documentation state that all 4 properties are required, but the implementation was a bit loose on that.