diff --git a/ext/data/schemas/dictionary-term-bank-v3-schema.json b/ext/data/schemas/dictionary-term-bank-v3-schema.json index 47305177b..0899c566e 100644 --- a/ext/data/schemas/dictionary-term-bank-v3-schema.json +++ b/ext/data/schemas/dictionary-term-bank-v3-schema.json @@ -119,6 +119,10 @@ "type": "string", "description": "Hover text for the element." }, + "open": { + "type": "boolean", + "description": "Whether or not the details element is open by default." + }, "lang": { "type": "string", "description": "Defines the language of an element in the format defined by RFC 5646." diff --git a/ext/js/display/structured-content-generator.js b/ext/js/display/structured-content-generator.js index fe926cf30..01d4af494 100644 --- a/ext/js/display/structured-content-generator.js +++ b/ext/js/display/structured-content-generator.js @@ -366,11 +366,12 @@ export class StructuredContentGenerator { break; } if (hasStyle) { - const {style, title} = /** @type {import('structured-content').StyledElement} */ (content); + const {style, title, open} = /** @type {import('structured-content').StyledElement} */ (content); if (typeof style === 'object' && style !== null) { this._setStructuredContentElementStyle(node, style); } if (typeof title === 'string') { node.title = title; } + if (typeof open === 'boolean' && open) { node.setAttribute('open', ''); } } if (hasChildren) { this._appendStructuredContent(node, content.content, dictionary, language); diff --git a/types/ext/structured-content.d.ts b/types/ext/structured-content.d.ts index 253f03245..4d7bd9d3f 100644 --- a/types/ext/structured-content.d.ts +++ b/types/ext/structured-content.d.ts @@ -130,6 +130,10 @@ export type StyledElement = { * Hover text for the element. */ title?: string; + /** + * Whether or not the details element is open by default. + */ + open?: boolean; /** * Defines the language of an element in the format defined by RFC 5646. */