Skip to content

Questions about DomUtil.preventDefault() #449

Description

@danallsop

Migrated from: Leaflet#9934
Original author: danallsop
Original created: 2025-10-07T22:20:02Z


So what I am confused about is why we are passing things that are not Event to this function in the first place. The test failures in Leaflet#9894 (comment) seem to indicate a larger issue that raises questions for me:

  1. Should we have been calling .preventDefault() on originalEvent if present? (e.g. we do have some special handling for stopping events
  2. Why does this originalEvent even exist in the first place? Could we possibly get rid of it?
  3. Is it even the responsibility of DomUtil.preventDefault() to check for the existence of preventDefault(), or should it have never been called in the first place? (perhaps this should have been handled in DomEvent.stop()?)

danallsop/core danallsop/leaflet-maintainers any insights into this?

Either way, I am approving this PR as this discussion is out of scope for what is being delivered here, so feel free to merge. I would still like to get some answers.

Originally posted by danallsop in Leaflet#9894 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions