ThePix / QuestJS

A major re-write of Quest that is written in JavaScript and will run in the browser.
MIT License
74 stars 16 forks source link

Error when trying to display character creation window: showModal function is absent. #73

Closed Kln95130 closed 3 years ago

Kln95130 commented 3 years ago

Hello. I am trying to have a character creation window, as shown here: https://github.com/ThePix/QuestJS/wiki/Character-Creation

However, I have the following error:

Uncaught TypeError: diag.showModal is not a function
    setUpDialog http://127.0.0.1:5500/lib/_settings.js:294
    touch http://127.0.0.1:5500/game/data.js:31
    outputFromQueue http://127.0.0.1:5500/lib/_io.js:916
    unpause http://127.0.0.1:5500/lib/_io.js:865
    onclick http://127.0.0.1:5500/:1

The function seems to have been removed at some point, as it is only present as a call in setUpDialog

Kln95130 commented 3 years ago

I had a hunch, and I checked the Javascript documentation.

This is actually a browser-based issue. showModal is incompatible with Firefox. Is there a way to find an alternative solution for people, players and devs alike, who use this browser?

ThePix commented 3 years ago

Thanks for highlighting that issue.

It looks like this is something that Firefox supported, but in an update it was changed so the user has to explicitly allow it, presumable as a security feature. See the compatibility table on this page: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal

One solution would be to send users to this page, to accept the risk and continue, and then click "Show all", fine "dom.dialog_element.enabled" and toggle it to "true".

Howewver, that is not ideal! I will look at a better solution.

ThePix commented 3 years ago

Turned out to be easy to correct. It now just uses "show" instead of "showModal", and disables/enables the interface itself.

You will need to download the updated files from GitHub as it is not in a release yet.