Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DocumentHandler: infoclick buttons that link to a document can reload the app #1344

Closed
jacobwod opened this issue Jun 5, 2023 · 0 comments
Closed
Assignees
Labels
Milestone

Comments

@jacobwod
Copy link
Member

jacobwod commented Jun 5, 2023

Describe the bug
An issue with DocumentHandler buttons in infoclick was just discovered. As of #1252, Hajk listens to change of the query string parameter of URL (everything after #). If that string changes, Hajk acts upon those changes (see #1252 for a list of parameters it looks for).

Now, DocumentHandler can produce infoclick buttons using the {foobar}@@documenthandler notation.

The problem is that currently the HTML element produced by this function is an anchor with a href value of "#". Clicking such a button changes the value of the query string, which in turns leads to new params being parsed by Hajk as of #1252.

But since the string is empty and it specifically lacks the m parameter, Hajk interprets this as a change of map from whatever the current value is to the default one.

Since a change of map config involves app reload, this is what happens:

Skarminspelning.2023-06-05.kl.14.59.10.mov

A better behaviour would be something like this:

Skarminspelning.2023-06-05.kl.14.58.42.mov

There's a small detail though: we don't want to change from A to BUTTON, since they render differently.


This portion of code looks a bit funny too:
Skärmavbild 2023-06-05 kl  15 02 40

We want to render a BUTTON when not printing. But we provide a value for href attribute and the MUI docs says that:

The URL to link to when the button is clicked. If defined, an a element will be used as the root node.

So this hard-coded href value made this to always render as an A element (except print mode) and never a BUTTON.

Proposed solution
I think I'll keep the element but remove the attribute to eliminate the query string change.

@jacobwod jacobwod added the bug label Jun 5, 2023
@jacobwod jacobwod added this to the 3.x milestone Jun 5, 2023
@jacobwod jacobwod self-assigned this Jun 5, 2023
@jacobwod jacobwod modified the milestones: 3.x, 3.12 Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant