Double tapping needed to focus on Stripe.js v3 elements (specifically on iPad/iPhone devices)

Recently, I've been experimenting with Bootstrap 4 beta and Stripe.js v3. Unlike the older version of Stripe.js, this newer one works by injecting iframes into spans and making them act as form inputs. While it claims to be more PCI compliant, I'm not completely sold on the approach.

For a demonstration, you can check out the following link: https://codepen.io/skunkbad/pen/BdgYmY

To simplify things, here's the reduced HTML code that represents my credit card input:

<span id="card-number" class="form-control">
        <!-- iframe is injected here by Stripe.js -->
    </span>
    

Due to the default CSS styles in Bootstrap 4, the span.form-control has a display property set to "flex". To address this issue, I had to override it by setting the display to "block".

#card-number.form-control {
        display:block;
    }
    

Fortunately, this adjustment seems to work well across various browsers:

  • Firefox on Ubuntu 16.04
  • Chrome on Ubuntu 16.04
  • Internet Explorer on Windows 8.1
  • Chrome on Android N Phone
  • Safari on iPad
  • Safari on iPhone

However, when testing on iOS devices like iPad and iPhone, users need to double-tap the field to focus and start typing. Interestingly, the Stripe.js Elements demo on the official website doesn't exhibit this behavior, leading me to believe it might be related to Bootstrap 4's CSS styling.

You can find the complete code below for your testing purposes:

... (most of the original code follows)

While attempting to tweak the styles or fonts of the Stripe Elements, there are limitations to what can be changed. My assumption is that the issue lies within the CSS rules of Bootstrap 4. Despite trying various modifications to the span styles, the problem persists.

Hence, my query is centered around pinpointing specific CSS adjustments that would enable iPad and iPhone users to interact seamlessly with a single tap, just like other devices. Any insights or suggestions are greatly appreciated!

Answer №1

After some trial and error, I finally cracked the code - well, at least I hope I did. By simply changing the display type from block to inline-block, IOS Safari decided to play nice.

#card-number.form-control {
    display:inline-block;
}

It's a mystery why block wouldn't cooperate, especially since it worked fine on all other devices I tested... but hey, sometimes technology has a mind of its own.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Switching between active navigation items using BootstrapVue and VueJs

If you're using VueJs and Bootstrap Vue and looking to append the "active" tag to your Nav links, check out the following example: <div> <b-nav tabs align="center"> <b-nav-item :active="isActive('/')"& ...

Tips for closing the mobile navigation bar on your device after clicking

Currently developing a website and in need of assistance with the mobile device navbar functionality. Essentially, I am looking to close the navigation when a specific link, such as "Destaques", is clicked. All I require is to remove the class "opened" upo ...

Customizing the styling of an anchor tag using CSS in Bootstrap

I want my active link to appear red: nav class="navbar navbar-inverse"> <div class="container col-1 col-sm-12"> <ul class="nav"> <li class="<%= 'active' if current_page?(squad_path) %> ...

Spread out the CSS grid dimensions to the descendants for the vuetify v-card image

I'm facing an issue with arranging vuetify cards with images in a CSS grid. The problem is that the grid size is not being recognized by the v-card's v-img because it's a grandchild element. How can I pass down the grid size to the v-img? M ...

The sourcemap generated by gulp is not functioning as expected

Custom Styling custom-styles.less @import "theme.less"; @import "layout.less"; theme.less body { background:blue; } layout.less body { font-family: Arial, sans-serif; } Build Process - Gulpfile.js var gulp = require('gulp'); var less = re ...

Erase the white backdrop from the dragImage

Is there a way to remove the white outline that appears when dragging a draggable element from a dark background? I want to make it completely transparent. Here is a visual representation: https://i.sstatic.net/Eywf9.png Here is the code snippet: docume ...

Upon a successful onChange event, the selected value reverts back to its default state

In my current project, I am creating a form where users can dynamically add or remove dropdowns to manage participants or voters. The goal is to prevent the same user from appearing in multiple dropdown lists once they have been selected. To achieve this ...

Despite using twitter bootstrap, the elements on my webpage are still overlapping one another

While implementing Twitter Bootstrap on my website, I encountered a problem where elements start overlapping if the window size is reduced. This issue does not look appealing, and I expected Twitter Bootstrap to ensure that my website is fully responsive a ...

the functionality of the multiple dropdown in JavaScript only functions once

Hi everyone, I am new to JavaScript and I am seeking assistance with a dropdown issue I am facing. Currently, I am using a JavaScript code for multi-level dropdowns. However, when I use it for multiple dropdowns, the second dropdown follows the sequence of ...

Trouble resizing webpage to fit screen dimensions

My latest project involves creating a business webpage with a two-column layout. I want to showcase an "About Us" section on one side, complete with bullet points below it. Everything looks great when viewing the page in full screen, but as soon as I resiz ...

The mysterious case of the vanishing close button on Curator.io's mobile

Currently, I am using curator.io aggregator to showcase my Instagram feed on the website. An issue arises when switching to mobile view as the close button (class="crt-close") disappears. You can see an example of this here: To replicate the pr ...

What specific style of CSS is utilized in Material UI's `sx` property feature?

I came across this code snippet in the Material UI documentation: <FormControl sx={{ "& > :not(style)": { m: 1 }, maxWidth: "100%", minWidth: "100%", }} > It appears that & is not a standard p ...

Unable to incorporate a comment form into my Django web application

I'm facing an issue while trying to include the form-group class (which I believe is a Bootstrap class) in my code. It seems like the form-group isn't functioning as expected, or there might be an issue with the form.author and form.body variable ...

When the Navbar div is set to Position:fixed, it generates empty space on the page

I'm facing the issue of unwanted white space in the center of the page below the Navigation Bar. Despite numerous attempts to remove it, I haven't been successful. Below is the HTML code snippet: html: <!DOCTYPE html> <html> <h ...

Create a captivating dropdown hover menu with animated CSS

My latest project involves creating a sleek CSS dropdown button/menu that I am now attempting to add animation to. Initially, the menu transitioned from display: none to display:block on hover, but I encountered issues animating it. So, I decided to switc ...

The width of the 'thead' section does not align with the width of the 'tbody' section

I am currently working with a table where the <thead> is fixed, but the width of each <th> does not align with the respective columns (<td>) in the <tbody>. If you have any questions or need more information, feel free to ask. Than ...

Can CSS be used to create an animation effect with just this image?

Is it possible to incorporate a running image of "Pikachu" using CSS instead of creating a heavier GIF format? I have the image link and code below, but need assistance on how to implement it. Can you provide guidance? image: .pikaqiu_run { width: ...

Issues with Django Crispy Forms Checkbox Visibility

Recently, I encountered an issue while trying to add a boolean field to my form using Django Crispy Forms. Despite everything else displaying properly, the checkbox was not showing up. The technologies involved in my project include Django 2.1, Python 3.6 ...

Alpha 6 Vertical Carousel in Bootstrap 4 - Take Your Website to New

Trying to create a carousel oriented vertically in Bootstrap 4 Alpha 6 has been a bit of a challenge. It's puzzling why the Bootstrap developers didn't include this orientation, but I've been working on my own solution. I suspect there' ...

Certain JavaScript code might fail to load on WordPress

I've been struggling to troubleshoot an issue with a JavaScript accordion menu on my WordPress site. When I try to click the accordion button, it doesn't reveal the hidden content beneath it. I've attempted various solutions, but none have s ...