Skip to main content

Abstract Class: CommentBarButton

Defined in: packages/blockly/core/comments/comment_bar_button.ts:17

Button displayed on a comment's top bar.

Extended by

Implements

Properties index

PropertyDescription
iconSVG image displayed on this button.
idThe ID of this button's parent comment.
workspaceThe workspace this button's parent comment is on.
containerAn SVG group that this button should be a child of.
commentView-

Methods index

MethodDescription
isVisibleReturns whether or not this button is currently visible.
getCommentViewReturns the parent comment view of this comment bar button.
repositionAdjusts the position of this button within its parent container.
performActionPerform the action this button should take when it is acted on.
getSizeReturns the dimensions of this button in workspace coordinates.
getMarginReturns the margin in workspace coordinates surrounding this button.
getFocusableElementReturns a DOM element representing this button that can receive focus.
getFocusableTreeReturns the workspace this button is a child of.
onNodeFocusCalled when this button's focusable DOM element gains focus.
onNodeBlurCalled when this button's focusable DOM element loses focus.
canBeFocusedReturns whether this button can be focused. True if it is visible.
recomputeAriaContextRecomputes the ARIA label and role for this button. Note that this is not automatically called during initialization and must be called once a button's focusable element (icon) is initialized. Implementations may also find it useful to call this if the button's label should be changed.
getAriaLabelReturns the ARIA label to use for this button (defaults to null). Note that this method will only be called and apply when recomputeAriaContext is called.

Constructors

Constructor

new CommentBarButton(
id,
workspace,
container,
commentView
): CommentBarButton;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:30

Creates a new CommentBarButton instance.

Parameters

ParameterTypeDescription
idstringThe ID of this button's parent comment.
workspaceWorkspaceSvgThe workspace this button's parent comment is on.
containerSVGGElementAn SVG group that this button should be a child of.
commentViewCommentView-

Returns

CommentBarButton

Properties

icon

abstract protected readonly icon: SVGImageElement;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:21

SVG image displayed on this button.


id

readonly id: string;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:31

The ID of this button's parent comment.


workspace

protected readonly workspace: WorkspaceSvg;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:32

The workspace this button's parent comment is on.


container

protected readonly container: SVGGElement;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:33

An SVG group that this button should be a child of.


commentView

protected readonly commentView: CommentView;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:34

Methods

isVisible()

isVisible(): boolean;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:40

Returns whether or not this button is currently visible.

Returns

boolean


getCommentView()

getCommentView(): CommentView;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:47

Returns the parent comment view of this comment bar button.

Returns

CommentView


reposition()

abstract reposition(): void;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:52

Adjusts the position of this button within its parent container.

Returns

void


performAction()

abstract performAction(e?): void;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:55

Perform the action this button should take when it is acted on.

Parameters

ParameterType
e?Event

Returns

void

Implementation of

IFocusableNode.performAction


getSize()

getSize(includeMargin?): Rect;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:63

Returns the dimensions of this button in workspace coordinates.

Parameters

ParameterTypeDefault valueDescription
includeMarginbooleanfalseTrue to include the margin when calculating the size.

Returns

Rect

The size of this button.


getMargin()

getMargin(): number;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:77

Returns the margin in workspace coordinates surrounding this button.

Returns

number


getFocusableElement()

getFocusableElement(): SVGImageElement;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:82

Returns a DOM element representing this button that can receive focus.

Returns

SVGImageElement

Implementation of

IFocusableNode.getFocusableElement


getFocusableTree()

getFocusableTree(): WorkspaceSvg;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:87

Returns the workspace this button is a child of.

Returns

WorkspaceSvg

Implementation of

IFocusableNode.getFocusableTree


onNodeFocus()

onNodeFocus(): void;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:92

Called when this button's focusable DOM element gains focus.

Returns

void

Implementation of

IFocusableNode.onNodeFocus


onNodeBlur()

onNodeBlur(): void;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:101

Called when this button's focusable DOM element loses focus.

Returns

void

Implementation of

IFocusableNode.onNodeBlur


canBeFocused()

canBeFocused(): boolean;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:104

Returns whether this button can be focused. True if it is visible.

Returns

boolean

Implementation of

IFocusableNode.canBeFocused


recomputeAriaContext()

protected recomputeAriaContext(): void;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:114

Recomputes the ARIA label and role for this button. Note that this is not automatically called during initialization and must be called once a button's focusable element (icon) is initialized. Implementations may also find it useful to call this if the button's label should be changed.

Returns

void


getAriaLabel()

protected getAriaLabel(): string | null;

Defined in: packages/blockly/core/comments/comment_bar_button.ts:133

Returns the ARIA label to use for this button (defaults to null). Note that this method will only be called and apply when recomputeAriaContext is called.

Returns

string | null

The ARIA label to use for this button, or null to use a default.