Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

textarea overrun detection?

ANSWERED

I know I can decide how a textarea object is displayed if the amount of text (with a given font/line height) overruns the screen area (the text can either be truncated, or an ellipsis can be displayed).


I want to provide a way for the user to tap the screen if there is an overrun to see more of the text, but if there is no overrun, I don't want the tap option available.


Is there any way to programmatically detect when this happens? It will take me a very, very long time to check every text value to be sure it fits on both Versa and Ionic, and record that in a data field for each text value to then know if I need to offer the tap option.

Thanks!

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

See what you can do with textOverflowing.

 

Failing that, you could do something clever with getBBox().

Peter McLennan
Gondwana Software

View best answer in original post

Best Answer
5 REPLIES 5

See what you can do with textOverflowing.

 

Failing that, you could do something clever with getBBox().

Peter McLennan
Gondwana Software
Best Answer

readonly textOverflowing

I think I read that part of the docs 4 or 5 times and I just didn't see it. Thanks!!

Best Answer

What I have noticed, however, is that sometimes it overruns but doesn't register an overrun. By that I mean, I see the ellipsis, and text is being cut-off, but textOverflowing is still false.

I'll have to experiment. I'm seeing some patterns with the wrapping... if there are large gaps that are left when words wrap this tends to happen more often.

If I find more about its behavior I'll come back and report.

Best Answer
0 Votes

More discoveries:

 

For textarea objects when you're trying to find out if the text has over-run it, it seems that the textOverflowing value doesn't always jump to true every time you see the ellipsis, or when text is truncated (depending on your textOverflow setting is).

Except, it seems to work if the size of the textarea is 100% by 100%. Then the textOverflow works perfectly.

Best Answer
0 Votes

Interesting.

 

I wonder if it would work if you set the size to 100%, but constrained it within a <section>.

Peter McLennan
Gondwana Software
Best Answer
0 Votes