MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / open

Method open

packages/playground/src/components/primitives/Dropdown.ts:200–224  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

198 }
199
200 private async open(): Promise<void> {
201 if (this.props.onOpen) {
202 const result = await this.props.onOpen();
203 if (Array.isArray(result)) {
204 this.setItems(result);
205 }
206 }
207 if (!this.menu.parentElement) {
208 document.body.appendChild(this.menu);
209 }
210 if (!this.popper) {
211 this.popper = createPopper(this.toggle, this.menu, {
212 placement: this.props.placement === 'bottom' ? 'bottom-start' : 'top-start',
213 modifiers: [{ name: 'offset', options: { offset: [0, 4] } }]
214 });
215 } else {
216 this.popper.update();
217 }
218 this.isOpen = true;
219 this.root.classList.add('open');
220 this.menu.classList.add('open');
221 this.toggle.setAttribute('aria-expanded', 'true');
222 document.addEventListener('mousedown', this.outsideClick, true);
223 document.addEventListener('keydown', this.onKey, true);
224 }
225
226 private close(): void {
227 this.isOpen = false;

Callers 1

constructorMethod · 0.95

Calls 6

setItemsMethod · 0.95
isArrayMethod · 0.80
addMethod · 0.80
appendChildMethod · 0.65
updateMethod · 0.65
addEventListenerMethod · 0.65

Tested by

no test coverage detected