Wednesday, October 28, 2026
HomeiOS Developmentjavascript - Place of picture open dialog on Safari iOS

javascript – Place of picture open dialog on Safari iOS

[ad_1]

I have to set off browser picture choice from picture library/digital camera in response to person clicking a customized ingredient (hiding the default <enter>).

Utilizing the usual code typically urged for this.

The HTML:

<enter id="image-input" fashion="show: none" kind="file" settle for="picture/*"/>
<button onclick="browse()">BROWSE</button>

And script:

<script>
  operate browse() {
    doc.getElementById("image-input").click on();
  }
</script>

This works as anticipated however on iOS (iPhone, 15.4), the place of the popup dialog is unpredictable.

More often than not the dialog pops up underneath the button however not precisely on the similar place, and typically it simply pops up on the backside of the web page. I can not seem to decide what person motion causes the completely different behaviors.

enter image description here

If I bear in mind accurately, in earlier iOS variations this dialog would open as a set drawer on the backside of the display?

Is there any option to management the place of this dialog? Ideally, I might prefer it to simply open as a set modal drawer on the backside however something that may make a constant controllable conduct would work too.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments