Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolbox search doesn't work with XML toolboxes due to case sensitivity #1925

Closed
BeksOmega opened this issue Sep 11, 2023 · 7 comments · Fixed by #1930
Closed

Toolbox search doesn't work with XML toolboxes due to case sensitivity #1925

BeksOmega opened this issue Sep 11, 2023 · 7 comments · Fixed by #1930
Labels
good first issue Good for newcomers type: bug Something isn't working

Comments

@BeksOmega
Copy link
Contributor

Category

  • Plugins

Component

toolbox-search

Describe the bug

The toolbox search plugin doesn't work if the 'kind' is upper case (which occurs when using XML toolboxes).

To Reproduce

Steps to reproduce the behavior:

  1. Go to the toolbox search playground file.
  2. Replace the DOMContentLoaded listener with the below code:
document.addEventListener('DOMContentLoaded', function() {
  const toolbox = {
    'kind': 'categoryToolbox',
    'contents': [
      {
        'kind': 'category',
        'name': 'Control',
        'contents': [
          {
            'kind': 'BLOCK',
            'type': 'controls_if',
          },
        ],
      },
      {
        'kind': 'category',
        'name': 'Logic',
        'contents': [
          {
            'kind': 'BLOCK',
            'type': 'logic_compare',
          },
          {
            'kind': 'BLOCK',
            'type': 'logic_operation',
          },
          {
            'kind': 'BLOCK',
            'type': 'logic_boolean',
          },
        ],
      },
      {
        'kind': 'search',
        'name': 'Search',
        'contents': [],
      },
    ],
  };
  const defaultOptions: Blockly.BlocklyOptions = {
    toolbox,
  };
  createPlayground(
      document.getElementById('root'), createWorkspace, defaultOptions);
});
  1. Run npm run start from the toolbox-search directory to open the playground.
  2. Type 'if' into the search.
  3. Observe how no blocks appear in the flyout.

Expected behavior

Blocks should appear.

To Fix

  1. Run through the reproduction steps and make sure you can reproduce the error.
  2. Modify getAvailableBlocks to be case insensitive. You probably want to use toUpperCase.
  3. Run the reproduction steps again to make sure the error doesn't reproduce.
@thebedigupta
Copy link

Will you explain the issue in more detail actually I am contributing first time so I need to know your problem in more detail @BeksOmega
image
here everything seems to be working

@BeksOmega
Copy link
Contributor Author

Hello! Thanks for your question :D It looks like you need to retry the reproduction steps. If they were done correctly, your toolbox should have a "Control" category, a "Logic" category and the Search category.

To further clarify: the case-sensitivity is a problem with what you search, but it is a problem with how the toolbox is defined. If you have 'kind': 'BLOCK' instead of 'kind: 'block' it breaks!

I hope that helps! If you have any further questions please reply :D Thank you for taking an interest in this issue!

@BeksOmega
Copy link
Contributor Author

Oh actually @thebedigupta It looks like @prasium has grabbed this issue in #1930

@thebedigupta If you'd still like to work on an issue let me know and I can recommend one!

@prasium in the future please comment on an issue if you're working on it so we don't get conflicts! We really appreciate you working on this, but don't want other folks to duplicate work =)

@prasium
Copy link
Contributor

prasium commented Sep 19, 2023

Okay sure @BeksOmega :D

@thebedigupta
Copy link

Yeah sure I would love to know if you have any begginer friendly issue assign me one @BeksOmega

@BeksOmega
Copy link
Contributor Author

BeksOmega commented Sep 20, 2023

Hiya @thebedigupta would you be interested in #1861 ? If so, comment on that issue and I'll get it assigned to you! Otherwise, reply here and I'll look for something else =)

@thebedigupta
Copy link

yeah I would love to work on that thank you @BeksOmega

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants