blockly-samples icon indicating copy to clipboard operation
blockly-samples copied to clipboard

Update toolbox-search to search dropdown field options

Open gonfunko opened this issue 2 years ago • 5 comments

Check for duplicates

  • [X] I have searched for similar issues before opening a new one.

Component

toolbox-search

Problem

No response

Request

The toolbox-search plugin should include the text of options in dropdown fields when filtering blocks. Right now, only the label text on the block (or the contents of text fields) are included in the index. Ideally, the matching option would also be shown pre-selected on the block in the toolbox.

Alternatives considered

No response

Additional context

No response

gonfunko avatar Sep 20 '23 19:09 gonfunko

To work on this bug:

  • Run npm install at the root of the repository to install all parts of blockly-samples
  • cd to plugins/toolbox-search
  • Run npm run start to open a playground and verify that the toolbox search plugin works for you
  • Make code changes (see below)
  • Verify that the changes work in the playground as expected

The code that searches block text is in indexBlocks in src/block_searcher.ts. Lines 31-32 loop over every filed and call indexBlockText(field.getText()).

  • Update this call to check if the field is a dropdown, and call indexBlockText for every option in the dropdown menu.
  • Update matchBlocks in src/toolbox_search.ts to set the value of the dropdown based on the query, if it doesn't match the default text on the block.

To verify, find a block with a dropdown (such as one of the math blocks) and do a search for a non-default value that is contained in the dropdown.

rachel-fenichel avatar Sep 22 '23 18:09 rachel-fenichel

https://github.com/sammitako and I have been working on this during the GHC OSD and would like to continue on finishing it. Can we both get assigned to this issue? Thanks!

ludizhan avatar Sep 22 '23 22:09 ludizhan

I think I have to tag @sammitako in order to assign to her. Let's see if this works.

rachel-fenichel avatar Sep 22 '23 22:09 rachel-fenichel

Thank you!

sammitako avatar Sep 22 '23 23:09 sammitako

Work still to be done: Select the proper option in the dropdown when searching.

BeksOmega avatar Sep 29 '23 19:09 BeksOmega