Skip to content

Adds create dom for the category#4090

Merged
alschmiedt merged 2 commits intoRaspberryPiFoundation:toolboxfrom
alschmiedt:category_init
Aug 3, 2020
Merged

Adds create dom for the category#4090
alschmiedt merged 2 commits intoRaspberryPiFoundation:toolboxfrom
alschmiedt:category_init

Conversation

@alschmiedt
Copy link
Copy Markdown
Contributor

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide

The details

Resolves

Adds create dom methods for a category.

Proposed Changes

Reason for Changes

Test Coverage

Tested on:

Documentation

Additional Information

*/
Blockly.ToolboxCategory.prototype.addColour_ = function(colour) {
if (colour) {
var border = '8px solid ' + (colour || '#ddd');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this hardcoded?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just updated.

this.htmlDiv_.appendChild(this.rowDiv_);

this.iconSpan_ = this.createIconSpan_();
Blockly.utils.aria.setRole(this.iconSpan_, Blockly.utils.aria.Role.PRESENTATION);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set roles inside your helper functions, at least for this, the label, and the group?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went back and forth with this a bit. By keeping these in the createDom method someone can overwrite the create methods without losing the accessibility labels. If we put them in their individual create methods we lose this, but increase the ability for the developer to create their own accessibility labels. Thoughts?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we expect all changes to the create methods to end up needing the same accessibility labels?

I see your point, though. There's a balance between code structure and making sure that accessibility is the default, and I think the latter is more important here.

If the accessibility labels end up being more than a few lines, let's put them in helper methods going forward.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think it depends a lot on the use case. They would definitely need to change the labels if they go away from the tree structure, but hard to say otherwise.

sgtm

@alschmiedt alschmiedt merged commit 733a500 into RaspberryPiFoundation:toolbox Aug 3, 2020
@alschmiedt alschmiedt deleted the category_init branch August 3, 2020 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants