Skip to content

Commit 832cc51

Browse files
authored
Merge pull request #19892 from OverflowCat/master
fix(aria): avoid throwing error in SSR mode (#19191)
2 parents bdc5d4f + 872ac99 commit 832cc51

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/visual/aria.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ export default function ariaVisual(ecModel: GlobalModel, api: ExtensionAPI) {
139139
}
140140

141141
function setLabel() {
142+
const dom = api.getZr().dom;
143+
// TODO: support for SSR
144+
if (!dom) {
145+
return;
146+
}
147+
142148
const labelLocale = ecModel.getLocaleModel().get('aria');
143149
const labelModel = ariaModel.getModel('label');
144150
labelModel.option = zrUtil.defaults(labelModel.option, labelLocale);
@@ -147,7 +153,6 @@ export default function ariaVisual(ecModel: GlobalModel, api: ExtensionAPI) {
147153
return;
148154
}
149155

150-
const dom = api.getZr().dom;
151156
if (labelModel.get('description')) {
152157
dom.setAttribute('aria-label', labelModel.get('description'));
153158
return;

test/node/ssr.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)