Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10803] MobileWeb: Textfield has misaligned text

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2017-06-26T22:11:58.000+0000
Affected Version/sRelease 3.0.0, Release 3.2.0
Fix Version/sn/a
ComponentsMobileWeb
Labelsapi, supportTeam
ReporterAlexander Miller
AssigneeEric Merriman
Created2012-09-06T14:29:15.000+0000
Updated2017-08-24T20:54:02.000+0000

Description

MobileWeb - Ti.UI.Textfield text misaligned

In certain conditions when the fontSize and textfield height are both small, the text is sometimes not vertically aligned correctly and usually drifts downwards where the text goes past the bottom of the textfield and becomes hidden. There are a few workarounds with one being manual and the other through a postlayout event. - The manual method involves typing in the textfield, clearing it, blurring it. The text should now be positioned correctly. - The postlayout event focuses and the blurs the textfield. The text should now be positioned correctly. Attached are images where it is incorrectly aligned and where it is correctly aligned.

Steps to reproduce:

1. Copy the code below into a new project 2. Run using mobileweb in chrome or internet explorer 3. Note the text is not aligned correctly. 4. workarounds below code

CODE:

var win  = Ti.UI.createWindow({
	backgroundColor: 'white'
});
win.open();
var view = Ti.UI.createView({
	height: 500,
	width: 500
});
var text = Ti.UI.createTextField({
	hintText: 'Required',
	backgroundColor: '#FFF',
	width: 40,
	height: 12,
	font: {
		fontSize: 7
	}
});
view.add(text);

//This postlayout event is a workaround for the bug
// text.addEventListener('postlayout', function() {
	// text.focus();
	// text.blur();
// });

win.add(view);

Workarounds

MANUAL fix: 1. Type in the textfield 2. clear the textfield 3. click on the URL bar to blur the textfield 4. The text should be in the correct position POSTLAYOUT fix: 1. uncomment the eventlistener section in the code above 2. Run using mobileweb or internet explorer 3. Note the text is now aligned correctly.

Attachments

FileDateSize
aligned.png2012-09-06T14:29:15.000+00006992
misaligned.png2012-09-06T14:29:15.000+00006721

Comments

  1. Lee Morris 2017-08-24

    Mobile Web has been deprecated and will be removed in fixVersion 7.0.0.

JSON Source