Don't load the navigable list controller on mobile
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
import { nextFrame } from "helpers/timing_helpers"
|
||||
import { isMobile } from "helpers/platform_helpers"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "item", "input" ]
|
||||
@@ -18,6 +19,11 @@ export default class extends Controller {
|
||||
onlyActOnFocusedItems: { type: Boolean, default: false }
|
||||
}
|
||||
|
||||
// Don't load for mobile devices
|
||||
static get shouldLoad() {
|
||||
return !isMobile()
|
||||
}
|
||||
|
||||
connect() {
|
||||
if (this.autoSelectValue) {
|
||||
this.reset()
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
import { nextEventNamed } from "helpers/timing_helpers"
|
||||
import { isTouchDevice } from "helpers/platform_helpers"
|
||||
|
||||
export default class extends Controller {
|
||||
// Only load for touch devices
|
||||
static get shouldLoad() {
|
||||
return "ontouchstart" in window && navigator.maxTouchPoints > 0
|
||||
return isTouchDevice()
|
||||
}
|
||||
|
||||
// Use a fake input to trigger the soft keyboard on actions that load async content
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
export function isTouchDevice() {
|
||||
return "ontouchstart" in window && navigator.maxTouchPoints > 0
|
||||
}
|
||||
|
||||
export function isIos() {
|
||||
return /iPhone|iPad/.test(navigator.userAgent)
|
||||
}
|
||||
|
||||
export function isAndroid() {
|
||||
return /Android/.test(navigator.userAgent)
|
||||
}
|
||||
|
||||
export function isMobile() {
|
||||
return isIos() || isAndroid()
|
||||
}
|
||||
Reference in New Issue
Block a user