question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rename the current Label component to NativeLabel and create a new Label that is compatible with FW8 Label

See original GitHub issue

Currently the Label component creates a <label> element in the client, which makes it not suitable to rendering loose text in the page, since the <label> in meant to be used in conjunction with other elements (usually <input>). This makes it semantically different from the old Label in FW8, which creates a <div> instead.

On top of that, the <label> element is an interactive content element, which makes it behave differently than a regular text in the page. For example, when used inside a Grid cell, clicking on a label doesn’t trigger the selection of the row (see https://github.com/vaadin/flow/issues/4313 for details).

My proposal to this issue is the following:

  1. Rename the current class from Label to NativeLabel (using the same naming structure as the NativeButton);
  2. Create a new Label class that behaves exactly like the old Label from FW8;
  3. Update demos and starters to use the new Label class;
  4. Update the documentation explaining the difference between those two classes.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
heruancommented, Jul 11, 2018

I wouldn’t rename Label. New developers approaching Vaadin will likely expect Label to be <label>, as Div is <div> and H1 is <h1>, and FW8 users are being made well aware that many things changed in Flow to be more HTML-intuitive.

I’d see more fit just a note in the Label JavaDoc warning about this.

1reaction
plekucommented, Aug 7, 2018

I see no reason to do any drastic changes anymore for this - yes it is something that existing (or swing based) users run into, but there has not really been that much questions and uproar on this topic that would make us want to change things anymore.

So I’m quite close to closing this as won’t fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change text of label whenever UserDefaults key value changes
I have an app where there are 2 views, one with a UILabel and another with a UITextField. I would like it so...
Read more >
how do I change text in a label with swift? - Stack Overflow
The idea is to write a message in a textField and have it change the label once I press a button. the objective-c...
Read more >
Apply a label to anything in React Native - Morioh
Do you want fully customizable labels? Do you want to embed stateful components in your labels? Do you want to label your labels?...
Read more >
UILabel Programmatically (Swift 4 + Xcode 9.0) - YouTube
In this video i will show how to create UI Label programmatically. I will show how to do:1) Text Alignment2) Label Background Color3)...
Read more >
UILabel - Tasharen Entertainment
You can change the alignment of the labels simply by switching the Pivot ... making the font size shrink down, not just scaling...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found