bigskysoftware / bigskysoftware/htmx

[htmx 4] Click events on elements with hx-get fail to trigger on iOS 15 Mobile Safari

Open
#4,023 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

Click/tap events on elements with hx-get fail to fire when opened in Mobile Safari on iOS 15 when using htmx 4. Downgrading the library to htmx 2 immediately resolves the issue without any changes to the HTML/CSS codebase.

To Reproduce
Steps to reproduce the behavior:

1. Create a simple button element with hx-get, hx-target, and hx-swap attributes:
```

← Previous

```
2. Load the page on an iPhone running iOS 15 Mobile Safari
3. Tap the button.

Expected behavior
htmx should intercept the tap event, issue an asynchronous GET request to the specified endpoint, and swap the target DOM node (#schedule-grid)

Actual behavior
Nothing happens upon tapping the button. No network request is initiated in the browser developer tools console

Environment: htmx version: htmx 4
Device: iPhone
OS: iOS 15
Browser: Mobile Safari
Server Stack: Server-Side Rendering

Additional context
Replacing the script tag source from htmx 4 back to htmx 2.x instantly fixes the problem on the exact same device and markup, allowing touch events to trigger AJAX requests as expected

Contributor guide

Open the contributing guide

Research direction

Start with the provided button markup and reproduce the failure on iOS 15 Mobile Safari using htmx 4, then compare the same case with htmx 2. Trace htmx 4's click or touch handling for elements with hx-get; done means tapping the button issues the GET request and swaps #schedule-grid as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.