Status Update
Comments
cl...@google.com <cl...@google.com> #2
First of all thanks for this detailed issue.
This issue had been investigated thoroughly when it was first reported internally. The surprising detail in this report is that the issue is not reproducible before 1.7
. I will look into this.
The main problem with POBox is the fact that it is deprecated. Since 2021 Sony has been shipping new Xperia devices with Gboard pre-installed. Although we are aware that there is still a considerable amount of users still using POBox, the described behavior is caused by POBox's noncompliant behavior with InputConnection
and InputMethodManager
documentation. However, this is understandable since TextView
implementation was also not respecting the behavior that is expected from Editors.
Ultimately we have decided to enforce the documented behavior with specifically regards to when editors should call InputMethodManager.updateSelection
. Also, although unconfirmed, there were traces of possible custom code being included in Sony OEM images that changed how InputMethodManager was notified from TextView. If POBox also depended on something like this, it would be impossible for Compose code to replicate the same unknown behavior.
ja...@google.com <ja...@google.com> #3
Or is that option not available?
Even if the root cause is POBox, from the perspective of the app's customers, it looks like an app bug, so this issue is a blocker against updating Jetpack Compose.
fa...@google.com <fa...@google.com> #4
Just to be sure, it is dangerous to replace Compose TextField with Android View EditText as a workaround for this issue.
Compose 1.7 has a bug that causes ANR when the focus is on EditText.
Another View-related bug in Compose 1.7 is that an Android View is focused by calling FocusManager.clearFocus().
Perhaps there is a lack of testing of Compose 1.7 in combination with Android View. There is also a possibility that there are other fatal bugs related to View.
In other words, the only options for apps targeting the Japanese market that require POBox support are to continue using Compose 1.6 or to use EditText in combination with various workarounds.
an...@google.com <an...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
Author: Halil Ozercan <
Link:
Fix POBox keyboard issue
Expand for full commit details
Fix POBox keyboard issue
Fix: 373743376
Fix: 329209241
Test: NullableInputConnectionWrapperTest
Change-Id: I94e0e598274fb88b255f977f9fbd50dfbbb1ecb1
Files:
- M
compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapperTest.kt
- M
compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapper.android.kt
Hash: 57f58c4b80d5d8470b2aca325dfdcd55f235231e
Date: Thu Oct 24 01:25:20 2024
si...@google.com <si...@google.com> #6
Many thanks again for this report. Especially for giving us a huge clue in terms of what could be going wrong. The fix is now merged and I will ask for a cherry-pick into a stable release.
an...@google.com <an...@google.com> #7
Do you have any concrete plan to cherry-pick the fix into current stable version (1.7.x)? We are currently waiting it.
ap...@google.com <ap...@google.com> #8
Yes, this fix is planned to be included in a future 1.7.x
release.
si...@google.com <si...@google.com> #9
Thanks for the fix. Sorry to follow up on this. is it possible for you to share specific release version/date for the stable version? We are waiting on this to decide on our direction.
si...@google.com <si...@google.com> #10
one option we had was to revert the CL since it causes issues that we did not foresee.
- For example in the devrel chat Chris Banes was surprised that all the text they had was now centered
- it looks like the layout system aligns things by default to center but not to start (which on its own imho a little off)
- If a text contains paragraphs in RTL and LTR then they wont be correctly aligned. (not for this ticket, but a related note, I am very not confident about the layout direction, textdirection, text align changes we made.)
Let's revert the change. and think again.
si...@google.com <si...@google.com> #12
But Text is incorrectly reporting its size when we have not enough size available.
Text was not incorrectly reporting its size, it was complying with the given max/min widths. so they were correct from the Text perspective.
an...@google.com <an...@google.com> #14
the original issue was that the text was saying that it is complying with the constraints - clamping the size by maxHeight - but it fact was drawing outside its reported size. so it said it will use 20.dp, but was drawing in a 30.dp area. This was very unpredictable. Now text at least clips by the bounds it reported. It is already better than before. And technically we can consider this bug as fixed by introducing clipping.
But what I don't like about text clipping is that it is inconsistent with everything else in Compose. No other composables clip on their own. If you want clip you add clip modifier. Imagine such situation:
Button(
modifier = Modifier
.preferredHeight(36.dp),
elevation = ButtonConstants.defaultElevation(0.dp),
onClick = { },
) {
Text("SEND", fontSize = 20.sp)
Image(Icons.Default.Add, modifier = Modifier.size(60.dp))
}
See the attached screenshot with how it currently works. The Button is said to have 36.dp. Button also introduces inner padding. The available scape is not enough to correctly fill both Text and Image, but they react differently: Text clips, but Image fills the real requested content size and as there is not enough space in the parent - parent automatically centres the Image - the default behavior Mihai build in the layout system
si...@google.com <si...@google.com> #15
Thanks Andrey.
The clipping issue
- is something that I am aware of (the other components not clipping). As
- you also mentioned it is another problem.
- Let me create an issue for it.
- On Text side I am happy not to clip but it comes with problems of expectations.
- TextOverflow currently have Clip, maybe it should have, and we should rely on modifiers (at the time we didnt have that)
- or TextOverflow should still have None, where Text says ok, i won't clip it is up to developer (which I like better).
- therefore we would be giving an option to developer to have more control on the clipping behavior.
The centering issue:
- Question:
- When Image is given a larger width, does it scale? Does it comply?
- Specific to the change we made before:
- We said Text should either comply or not comply for both width and height. If it accepts width to be larger (changing this cause trouble), then it should accept height to be larger.
- Mihai mentioned that Text is different in the sense that there is a different relation with the width and height (width in height out). Therefore height can be special.
I wonder if this issue also requires a configuration. We changed the behavior and hit to a wall, if we had a configuration (through a modifier or a config option) it would be possible for a developer to enable the behavior you mentioned: Text will not comply with the rules, it will fit its box.
Lets keep this ticket open.
si...@google.com <si...@google.com> #16
btw :)
Text("SEND", fontSize = 20.sp) Image(Icons.Default.Add, modifier = Modifier.size(60.dp))
Image gets a size. if Text had the same modifier Modifier.size(60.sp.toDp()) it would behave the same.
si...@google.com <si...@google.com> #17
some notes from discussion with Mihai
- the option mentioned in coment#15 can be TextOverflow.None
- TextOverflow.Clip might not be needed for Compose (it came from CSS originally)
- TextOverflow can be [None, Ellipsis] (maybe later Fade) which cuts the text but not the drawing.
- When TextOverflow.None, developers use clip modifier.
- Open question: When TextOverflow.None, Text reports the real size (definitely height, don't know width) (fot width: think about softwrap)
an...@google.com <an...@google.com> #18
Yes, I intentionally added the fixed size on Image as image is scaleable. Without the modifier it will just scale to fill the available amount. But text is not scaleable(eg will not auto decrease the font size to fill within the available area) so it was more fair to compare text with the Image with fixed size.
si...@google.com <si...@google.com> #19
for
Will close this ticket, and postpone the mentioned ticket.
Description
Button(
modifier = Modifier
.padding(horizontal = 16.dp)
.preferredHeight(36.dp),
elevation = 0.dp,
onClick = onMessageSent,
disabledContentColor = MaterialTheme.colors.onSurface.copy(alpha = 0.38f),
) {
Text(stringResource(id = R.string.send), modifier = Modifier.padding(horizontal = 16.dp))
}
Making the Text bigger than the Button will misalign it vertically (moving it down).
The workaround is to set the padding to 0:
padding = InnerPadding(0.dp)
And make sure the height of the contents doesn't exceed the Button's.