Monogatari icon indicating copy to clipboard operation
Monogatari copied to clipboard

Undefined dataset on language select in Settings-Screen

Open JulianSchoenbaechler opened this issue 1 year ago • 0 comments

When clicking on the arrow-icon [data-select="set-language"] of the language selection dropdown the action will break with:

Uncaught TypeError: t.dataset is undefined

The erroneous code is this piece right here:

// Fix for select labels
this.engine.on ('click', '[data-select]', () => {
	const e = document.createEvent ('MouseEvents');
	e.initMouseEvent ('mousedown');
	this.engine.element ().find (`[data-action='${this.dataset.select}']`).first ().dispatchEvent (e);
});

I'm guessing that the this inside the arrow function does not refer to the actual HTMLElement of the icon.

JulianSchoenbaechler avatar Jan 11 '24 13:01 JulianSchoenbaechler