Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SelectionContainer can't show options menu on iOS #4322

Closed
robxyy opened this issue Feb 17, 2024 · 9 comments
Closed

SelectionContainer can't show options menu on iOS #4322

robxyy opened this issue Feb 17, 2024 · 9 comments
Assignees

Comments

@robxyy
Copy link
Contributor

robxyy commented Feb 17, 2024

Describe the bug
SelectionContainer can't show options menu on iOS

Affected platforms
Select one of the platforms below:

  • iOS

Versions

  • Kotlin version*: 1.9.22
  • Compose Multiplatform version*: 1.6.0-rc02

To Reproduce

When long pressing SelectionContainer, the options menu can't be shown , like Copy ...

SelectionContainer {
  Text(text = "Hello World!")
}

Expected behavior

Show options menu like Android

Screenshots

@robxyy robxyy added bug Something isn't working submitted labels Feb 17, 2024
@dima-avdeev-jb dima-avdeev-jb added ios reproduced enhancement New feature or request and removed submitted bug Something isn't working labels Feb 17, 2024
@bonamanada
Copy link

It is not reproduced in version 1.6.0-alpha01, but is reproduced starting from version 1.6.0-beta01.

@MatkovIvan
Copy link
Member

@bonamanada jfyi 1.6.0-alpha01 is 1.5.x + WASM, it doesn't contain actual 1.6 changes

@brendanw
Copy link

@dima-avdeev-jb @mazunin-v-jb I am seeing this on compose 1.6.1 -- this is a pretty serious regression. Is there an ETA for a fix?

@mazunin-v-jb
Copy link
Contributor

mazunin-v-jb commented Apr 15, 2024

Should be included in the next release (1.6.10)

MatkovIvan pushed a commit to JetBrains/compose-multiplatform-core that referenced this issue Apr 19, 2024
## Proposed Changes

**Cherry-picked from androidx**

Fix a typo in `SelectionManager.getContentRect()` that results in an
invalid rect being calculated, causing text toolbar to not show under
certain conditions.

Fixes: b/332782845
Test: manual
Change-Id: I153b99f4146d870182af2898d9a675ed6ffa15e4

## Testing

Test: Open test app, go Components -> Selection, try to select text in
selection container

## Issues Fixed

Fixes: appearing of editing menu in selection container in wrong
position

https://youtrack.jetbrains.com/issue/COMPOSE-1190/iOS-Selection-Container-cant-show-options-menu
JetBrains/compose-multiplatform#4322
b/332782845 in Google

## Google CLA
You need to sign the Google Contributor’s License Agreement at
https://cla.developers.google.com/.
This is needed since we synchronise most of the code with Google’s AOSP
repository. Signing this agreement allows us to synchronise code from
your Pull Requests as well.

Co-authored-by: Albert Chang <mxalbert1996@gmail.com>
MatkovIvan pushed a commit to JetBrains/compose-multiplatform-core that referenced this issue Apr 19, 2024
…1269)

## Proposed Changes

- Added creating a text interaction view (which is required to show the
edit menu by long press / double tap on the text) in case when there is
no one (i.e. only selection container presents of the screen without any
other text editing views)
- Fixed its position on the screen (changes from androidx:
#1270)

## Testing

Test: Open test app, go Components -> Selection, try to select text in
selection container

## Issues Fixed

Fixes: 
-
https://youtrack.jetbrains.com/issue/COMPOSE-1190/iOS-Selection-Container-cant-show-options-menu
- JetBrains/compose-multiplatform#4322

## Google CLA
You need to sign the Google Contributor’s License Agreement at
https://cla.developers.google.com/.
This is needed since we synchronise most of the code with Google’s AOSP
repository. Signing this agreement allows us to synchronise code from
your Pull Requests as well.
@brendanw
Copy link

@mazunin-v-jb I just tested 1.6.10-beta01 and still seeing the issue fwiw.

@mazunin-v-jb
Copy link
Contributor

mazunin-v-jb commented Apr 20, 2024

@brendanw beta01 doesn't contain that fix, please wait for the beta02

@robxyy
Copy link
Contributor Author

robxyy commented Apr 25, 2024

@mazunin-v-jb beta2 has fixed this issue, but there are still two issues:

  1. When using SelectionContainer with Text, the keyboard will be shown
SelectionContainer {
  Text(text = "Hello World!")
}
  1. When using SelectionContainer with Column or Row, scrolling Column leads to the selected text cursor being lost
Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState())) {
  SelectionContainer {
    Text(
      text = (0..300).fold("") { text, _ ->
        text + "Hello World!"
      },
    )
  }
}

@brendanw
Copy link

brendanw commented Apr 26, 2024

I am also seeing the same two issues as @robxyy on beta02

@mazunin-v-jb
Copy link
Contributor

mazunin-v-jb commented Jun 17, 2024

@robxyy
Thanks for describing problems!
Since these two problems are not related to options menu, I decided to move them out into separate issues: (iOS) Selection Container shows keyboard while selecting text and Dragging to scroll clears selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants