label and input same line - jquery-mobile

.0I have a problem aligning the labels to the input fields with a mobile device (normal browser does not have any problem with that).
What I have:
<div data-role="fieldcontain">
<label for="name">Label:</label>
<input data-mini="true" type="text" name="name" id="name" value="" />
</div>
In my head I have a media query like
<meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1.0,maximum-scale=1.0">
Example, what I have:
Label
What I want to have under a 450px i.e.:
Label ________
The label (according to the media queries in the css) moves to the left side of the input field if the width is over 450px. This works like a charm in my local browser. But if I access this with any mobile device regardless of the resolution(tries s3, iphone and other devices) the label gets always displayed on top of the textfield(in non landscape mode).
I would like to understand why this behavior occurs on a mobile device. Does this have sth. to do with the viewport? Im not familiar developing on mobile devices and their specific media queries.
I fully aware that there are workarounds like grids and tables. But I would like to have this behavior for my web app. It makes sense on smaller devices that its getting displayed in 2 lines. I would like to do it without overriding jquery mobile classes and writing my own solution if there is a way.
Thanks in advance!

css file:
jquery.mobile-1.2.0.min.css
edit:
3227.line: #media all and (min-width:300px) {

Related

How can I prevent content from being visible above the toolbar for notched phones like iPhone X?

I have an app that uses Angular Material Design 2 (wrapped in Cordova) and has a toolbar and sidenav. On notched phones that run iOS (like the iPhone X), when the user scrolls the content on the page is visible above the toolbar where the notch area is. This doesn't happen on my LG G7, which has a notch and is running Android, though that may just be my settings because I think I remember "hiding" the notch.
I've sort of proven that this isn't phone specific by taking the example StackBlitz that Material Design provides for responsive layout and deliberately adding some margin to it to create an artificial space. See here: https://stackblitz.com/edit/angular-pdh21g . When you scroll, you can see where the content is still visible above the toolbar. I am wondering what CSS I need to add to force the content's top limit to remain below the toolbar? I tried various settings for the meta tag in my HTML for viewport-fit, but nothing seems to change it. Here is what it is right now:
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
So essentially, I need to either force the top of the page to be below the notch, or force the content to stay below the toolbar.
EDIT: I just realized that the HTML portion might be relevant because it uses "fixedTopGap" - a portion of it is below:
<mat-sidenav-container class="example-sidenav-container"
[style.marginTop.px]="mobileQuery.matches ? 56 : 0">
<mat-sidenav #snav [mode]="mobileQuery.matches ? 'over' : 'side'"
[fixedInViewport]="mobileQuery.matches" fixedTopGap="56">
<mat-nav-list>
<a mat-list-item routerLink="." *ngFor="let nav of fillerNav">{{nav}}</a>
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content>
<p *ngFor="let content of fillerContent">{{content}}</p>
</mat-sidenav-content>
</mat-sidenav-container>

Bootstrap 3 - Input zoom on iOS looks odd with input-group-addon

I am using Bootstrap 3 on my current project and on my login page, I used the input-group-addon for the first time. My code currently looks like this:
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-user"></span></div>
<input class="form-control" type="email" name="email" required placeholder="E-Mail">
</div>
When I open the page on my iPhone with Safari and click the input field, it zooms in to the input field (centering it), as it always does. However, in this case it looks very odd due to the addon being left to it. Is it possible to center the entire "input-group", instead of just the input field, while still enabling the user to enter the input?
Thanks in advance! If any code is missing or you are looking for more information, I would be happy to provide it.
I found out now, that the zoom-effect occurs in Safari mobile, when the font-size of the text field is < 16px. Setting the font-size to 16px resolved the issue for me, as my input field with the addon was centered before and is no longer additionally zoomed in.
Additionally, the select element needs to have the focus pseudo-class attached.
.form-control:focus{
font-size: 16px;
text-align:center;
}

iOS Web Page Scrolling Issues

Problem: I have developed a basic web site using GoDaddy's Website Builder V7. See it here --> oktoberfestvisits.com . It is not iPad aware or optimized in any way since I have very little control over HTML, etc that is generated. All the pages appear to display properly, however, I have two problems I do not understand.
When trying to scroll quickly, ie. swiping down or up, the page only scrolls about 5 or so lines at a time. Is there something in the page that controls or prevents smooth scrolling (Momentum Scrolling)? All other web sites and web pages scroll fine.
When in the middle of the page, touching on the black title bar at the top of the screen does not snap back to the top of the page. Like above, is there something that controls or prevents this? Like above, all other web sites and web pages work fine.
I can make some minor HTML additions if necessary, but I do not know what causes this. Is there something that needs to be on my pages so that the iPad scrolls smoothly?
.sc {
-webkit-overflow-scrolling: touch;
}
Add this css code to style sheet and then add "sc" class on the page which that scroll issue. Like if you put finger on <input /> field and quickly scroll, but it doesnt scroll then put sc class on input field or add to its parent element.
e.g.
<div class="sc">
<div class="form-group sc">
<input type="text" placeholder="First Name"/>
</div>
<div class="form-group sc">
<input type="text" placeholder="Last Name"/>
</div>
<div class="form-group sc">
<input type="text" placeholder="Email"/>
</div>
<div class="form-group sc">
<input type="text" placeholder="Property Units"/>
</div>
</div>
The whole page is in a div with position: absolute;. I think this causes the scrolling error on iOS.
It appears that iOS has laggy scroll when you use overflow: hidden or overflow-x: hidden. Try to avoid that.

Force Number keyboard on ipad for contenteditable element

I'm using contenteditable in several sections of our time keeping app. Since we're logging time, naturally, I want the keyboard to automatically switch to the number keyboard for ipad users. I've tried adding all the attributes to the elements that I can think of such as:
Type=number
Type=tel
pattern=[0-9]*
but ipad still loads the default keyboard.
Here's an example:
<div class="editable validate numbers-only" contenteditable="true" type="number" pattern="[0-9]*">3</div>
Are there any tricks that I can use to display the number keyboard for my ipad users?
you can set the inputmode attribute on a contenteditable element to control which keyboard is displayed, at least in chrome and mobile safari. for example:
<div contenteditable=true inputmode=decimal><div>
i tested out a few more examples here: https://notatoad.github.io/inputmodes.com/
I read in this post that you can use the \d* pattern to make the number keyboard appear on iOS, so a basic form with a number keyboard would look like:
<form>
<input type="text" pattern="\d*">
<button type="submit">Submit</button>
</form>
which should cause a number keyboard to automatically appear on iOS when entering form information.
Now, I'm pretty sure we could extrapolate this and say that we could use \d* on the contenteditable div to answer the question:
<div class="editable validate numbers-only" contenteditable="true" type="text" pattern="\d*">3</div>
I hope this works out for you?
I am not sure how you are using the keyboard here? Means, Is the user adding / Updating time or something? If they do, make the input type to number. This is will tell the browser (safari) that this is input for only numbers and it will tell the iOS to show number pad automatically.
<input type="number">
Checkout my fun project called weight calculator. Check how it will prevent any other keys inside input as well as it will show Number pad in mobile device.
Weight Calculator
<form>
<input type="text" pattern="\d*">
<button type="submit">Submit</button>
</form>
then
<div class="editable validate numbers-only" contenteditable="true" type="text" pattern="\d*">3</div>
<input type="tel" pattern="[0-9]*" novalidate>
This should give you the nice numeric keyboard on Android/iOS phone browsers, disable browser form validation on desktop browsers, not show any arrow spinners, allows leading zeros, and allows commas and letters on desktop browsers, as well as on iPad.

iPad HTML5 default keyboard to symbol view?

I have a data entry form in a HTML5 application that users will be filling in on an iPad 2.
Is there any way to make the iPad keyboard default to the "Symbols" view (i.e. the keyboard with the numbers 1,2,3,4,5,6,7,8,9,0)?
They will only be entering numbers in these fields, and it's quite frustrating every time you hit "next" it reverts back to the QWERTY view.
You could do this on the iPhone by using some -wap CSS, but it doesn't work on the iPads unfortunately.
Wossname's solution above works well, but if you are also using this method to hide the spin buttons that Webkit add to <input type="number" /> in desktop Safari, it will also disable the placeholder attribute in desktop Safari.
Using type="text" pattern="[0-9]*" instead of type="number" seems to fix both of these issues.
I haven't tested this myself, but according to Apple's docs this should work:
<input type="number">

Resources