-
Notifications
You must be signed in to change notification settings - Fork 56
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
Don't allow interactions with URL in Aztec text blocks. #1375
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe by default now if no delegate method is implemented the system assumes a true answer?
I see in the docs that: Links in text views are interactive only if the text view is selectable but noneditable. That is, if the value of the UITextViewisSelectable property is true and the isEditable property is false.
At the moment when it is called, I can see that isEditable
is true.
And in fact, on iOS 12 it is not assuming false by default, but it is never called.
Might this be an iOS 13 bug?
A drawback of this solution is that links became completely unresponsive also for selection. As an example in the last example block, that is a list block with links, it's not possible to select any of the list items, or set the cursor anywhere in between by tapping.
I tested a fast workaround, something like this:
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
let position = characterRange.location as NSNumber
setSelection(start: position, end: position)
return false
}
and it (kind of) works, but still not as nice as it was before. It will just set the cursor at the beginning of the link.
@etoledom I'm able to force touch and drag the cursor on the links, are you able to do that with your solution above? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @SergioEstevao - This works a lot better!
Sadly is not as good as it was before, but since this is a workaround of an iOS bug I think its fine. Not sure if we have any other options anyway, so ✅
I spotted a weird behavior, it might be related to #1161 (or not).
- When I tap on a link, the cursor goes to the beginning of the linked text ✅
- The link toolbar button is not selected (✅ I guess?)
- Pressing the toolbar button shows an empty link bottom sheet (✅ according with ⬆️ )
- Dismissing the bottom-sheet will remove the link from the linked text (❌)
Let me know if you think that this is not worth fixing on this PR. We can try tackle this separately.
I think I'm missing something here, but wouldn't it be enough to implement that delegate method to always |
@koke that was my first solution but the problem then is that the link text will be completely non interactive, if you tap on it, it will not move the cursor to it... This is a bad bug from iOS 13... |
@etoledom I fixed the bug you detected for link removal, can you give it another spin? |
Then I must be missing something because I tried without the selection workaround and I'm seeing the same interactions: video |
@koke could you check if the delegate method is being called? And what iOS version are you testing on? Maybe this bug has been already fixed on the latest iOS 13.1 release. 🤔 |
What version of IOS you are using? We were seeing it on 13 and 13.1 . Maybe Apple fixed it on 13.1 before they release it.
…Sent from my iPhone
On 30 Sep 2019, at 08:28, Jorge Bernal ***@***.***> wrote:
Then I must be missing something because I tried without the selection workaround and I'm seeing the same interactions: video
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I was testing with Xcode 11.1 GM and iOS 13.1 |
Just updated my testing device to the latest 13.1 ("Seed 4" from the beta program) and now it is behaving as @koke described. The delegate override is still needed but just returning false is enough to make it behave as it did before. 👍 There's also an iOS v13.1.1 🤔 |
Also related, I came across this PR because I was investigating this other issue and it caught my attention wordpress-mobile/WordPress-iOS#12568 |
Working good now! 🎉 Let's update the PR to make it work properly with the released iOS 13.1 version 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on iOS v13.1 and v12.4 and works well on both.
Couldn't test on iOS v13.0, but the workaround works well on an older buggy 13.1 release 👍
The link removal fix from WordPress/gutenberg#17631 works well on both iOS and Android 🎉
Hey @SergioEstevao, |
We should probably merge #1393 first? |
# Conflicts: # react-native-aztec/ios/RNTAztecView/RCTAztecView.swift
…pens_safari Don't allow interactions with URL in Aztec text blocks. # Conflicts: # gutenberg
Fixes #1373
This PR adds a new delegate method to avoid that interaction with URL attributes happens.
From the documentation it looks this delegate existed since iOS 10, but only with iOS 13 it became a problem. Maybe by default now if no delegate method is implemented the system assumes a
true
answer?To test:
Update release notes:
RELEASE-NOTES.txt
.