Skip to content
This repository was archived by the owner on Apr 28, 2026. It is now read-only.
This repository was archived by the owner on Apr 28, 2026. It is now read-only.

Improper use of DOM events #116

Description

@Voltra

Current state: When clicking on a link that could trigger navigation, if the click event is prevented in an event listener, the navigation command is still processed.

Desired behavior: preventDefault being called on the event should cancel the navigation command before it's even issued

How it can be fixed: Check for e.defaultPrevented where it makes sense

Current hack fix:

class Router extends Highway.Core {
  navigate(e) {
    if(e?.defaultPrevented) {
      return;
    }

    super.navigate(e);
  }
}

const router = new Router(/* [...] */);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions