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

fix: set button type to 'button' and format workspace_search.ts

Open viky-01 opened this issue 6 months ago • 5 comments

The basics

  • [x] I validated my changes

The details

Resolves

Fixes #2510

Proposed Changes

Updated the createBtn helper method in the workspace-search plugin to explicitly set the button’s type attribute to "button".

private createBtn(className: string, text: string): HTMLButtonElement {
  const btn = document.createElement('button');
  Blockly.utils.dom.addClass(btn, className);
  btn.type = "button";
  btn.setAttribute('aria-label', text);
  return btn;
}

viky-01 avatar May 30 '25 03:05 viky-01

Hi @viky-01 , thanks for the pull request and for your patience as our team was at our summit last week.

This PR is failing the format check. To fix this you can run npm run format and then commit the changes. You can run npm run lint to also make sure there are no other lint errors that didn't get auto-fixed. If you push those changes to your same branch, this PR will auto-update and there's no need to close the PR and open a new one. Thanks!

maribethb avatar Jun 13 '25 21:06 maribethb

Hi @viky-01, please use this PR instead of opening new ones in response to comments. In order to fix this PR, you need to

  1. Checkout the branch you used for this PR: fix/workspace-search-button-type-v2
  2. Run npm run format from the root of blockly-samples
  3. Commit the changes
  4. Push the commit to your remote repository (i.e. push the changes from your local computer to github)
  5. That's it. This PR will automatically update with any changes you push to the viky-01:fix/workspace-search-button-type-v2 branch.

If you need additional help with using GitHub you may want to try a GitHub tutorial or guide like this one, or practice in your own repository before opening additional pull requests for the same issue. Thank you!

maribethb avatar Jun 20 '25 18:06 maribethb

@maribethb it is failing because of prettier command, but running npx prettier --write plugins/workspace-search/src/workspace_search.ts command makes multiple changes. Please guide me

viky-01 avatar Jun 23 '25 05:06 viky-01

@viky-01 I think you just need to replace the double quotes " with single quotes '

RoboErikG avatar Jun 23 '25 16:06 RoboErikG

Hi @viky-01 , you don't need to run prettier manually. From the root directory of blockly-samples, run npm ci to make sure your dependencies are up to date, then run npm run format. The format command will run prettier for you. Then you can commit those changes.

The problem with running prettier from npx prettier is that if your version of prettier doesn't match what's specified in the package-lock.json file, then you'll get a bunch of changes because each version of prettier can introduces formatting changes. So running npm ci first ensures that you will be using the same version of prettier as everyone else modifying this code. I hope this helps!

maribethb avatar Jun 23 '25 17:06 maribethb

Hi @viky-01 I'm going to close this PR since you have not pushed any additional commits to it. Please reopen it if you would like to continue working on it. Thanks!

maribethb avatar Jul 21 '25 21:07 maribethb