mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 17:23:21 -05:00
Fixing clickable state of infobox not setting properly when initializing it. (#18763)
* Fixing clickable state of infobox not set when initializing it. * Removing unnecessary calls to a method
This commit is contained in:
@@ -68,6 +68,7 @@ export class InfoBox extends Disposable implements IThemable {
|
||||
this.isClickable = (options.isClickable === true);
|
||||
this.clickableButtonAriaLabel = options.clickableButtonAriaLabel;
|
||||
}
|
||||
this.updateClickableState();
|
||||
}
|
||||
|
||||
public style(styles: IInfoBoxStyles): void {
|
||||
@@ -125,21 +126,7 @@ export class InfoBox extends Disposable implements IThemable {
|
||||
return;
|
||||
}
|
||||
this._isClickable = v;
|
||||
if (this._isClickable) {
|
||||
this._clickableIndicator.style.display = '';
|
||||
this._clickableIndicator.tabIndex = 0;
|
||||
this._infoBoxElement.style.cursor = 'pointer';
|
||||
this._infoBoxElement.setAttribute('role', 'button');
|
||||
this._textElement.style.maxWidth = 'calc(100% - 75px)';
|
||||
this.registerClickListeners();
|
||||
} else {
|
||||
this._clickableIndicator.style.display = 'none';
|
||||
this._clickableIndicator.tabIndex = -1;
|
||||
this._infoBoxElement.style.cursor = 'default';
|
||||
this._infoBoxElement.removeAttribute('role');
|
||||
this._textElement.style.maxWidth = '';
|
||||
this.unregisterClickListeners();
|
||||
}
|
||||
this.updateClickableState();
|
||||
}
|
||||
|
||||
private registerClickListeners() {
|
||||
@@ -193,4 +180,22 @@ export class InfoBox extends Disposable implements IThemable {
|
||||
this._infoBoxElement.style.backgroundColor = backgroundColor.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private updateClickableState(): void {
|
||||
if (this._isClickable) {
|
||||
this._clickableIndicator.style.display = '';
|
||||
this._clickableIndicator.tabIndex = 0;
|
||||
this._infoBoxElement.style.cursor = 'pointer';
|
||||
this._infoBoxElement.setAttribute('role', 'button');
|
||||
this._textElement.style.maxWidth = 'calc(100% - 75px)';
|
||||
this.registerClickListeners();
|
||||
} else {
|
||||
this._clickableIndicator.style.display = 'none';
|
||||
this._clickableIndicator.tabIndex = -1;
|
||||
this._infoBoxElement.style.cursor = 'default';
|
||||
this._infoBoxElement.removeAttribute('role');
|
||||
this._textElement.style.maxWidth = '';
|
||||
this.unregisterClickListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user