jverdi / jverdi/JVFloatLabeledTextField

Feature Request: Add support for multi-line floating labels and Dynamic Type

Open
#222 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
7.1k
Forks
720
PR merge metrics
No merged PRs in 30d

Description

The current version of the textField doesn't support Dynamic Type. To do this it would need to ensure that a scaled variant of a UIFont is used for the floating label (or opt-in somehow), can use `numberOfLines == 0`, word wraps and also sets `adjustsFontForContentSizeCategory = YES`.

Typically a single line for the floating label is fine but when using Dynamic Type and especially in the larger Accessibility content sizes, a single line will truncate too much of the label - which should be fully visible to users at all times. So it ideally should be possible for it to span multiple lines. This causes layouts and constraints in the example project to break, the floating label overlaps with the textfield content and doesn't resize properly.
I believe that the layouts shouldn't assume that the height of the floating label is equal to the `_floatingLabel.font.lineHeight` however just replacing that everywhere with `_floatingLabel.frame.size.height` doesn't correctly adjust the textfield content for the floating label. The example project also assumes that the textfield height is 44. I also tried to change this but was unsuccessful.

Unfortunately, I've managed to get it working on an older version of the library but it's diverged too much from the current version to be able to create a PR.

![Simulator Screen Shot - iPod touch (7th generation) - 2021-05-26 at 10 12 48](https://user-images.githubusercontent.com/2385924/119634727-ecfebd00-be0a-11eb-9228-dbee570aa8b4.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting the current textField implementation and the example project layouts, focusing on floating-label sizing, Dynamic Type, wrapping, and the assumptions around a 44-point text field. Reproduce the issue with larger Accessibility content sizes. Done means the floating label remains fully visible across multiple lines and the textfield content and example layouts resize without overlap or broken constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c
Domain
accessibility, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.