Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Can't change cursor position at address bar #1371

Closed
tsekityam opened this issue Sep 23, 2018 · 7 comments
Closed

Can't change cursor position at address bar #1371

tsekityam opened this issue Sep 23, 2018 · 7 comments

Comments

@tsekityam
Copy link
Contributor

tsekityam commented Sep 23, 2018

Step to reproduce

  1. make a typo when you enter a url, e.g. http://firemox.com
  2. long press at the end of the url
  3. try to move the cursor to the typo by moving the finger

What did I see

The Url is dragged away from the url when I move my finger
Firefox Focus

What do I expect

The cursor position follows my finger and the url should not be dragged away unless the url is selected.
P.S. Safari's behavior
Safari


Firefox Focus 7.0 on iPad Pro 9.7

@sblatz
Copy link
Contributor

sblatz commented Oct 23, 2018

This is almost certainly an issue with our drag implementation. We should disable drag and drop when the urlBar isEditing and the URL is not fully selected

@tsekityam
Copy link
Contributor Author

I can help disable it.

@sblatz
Copy link
Contributor

sblatz commented Oct 24, 2018

That'd be great, @tsekityam, thanks!

@tsekityam
Copy link
Contributor Author

tsekityam commented Oct 25, 2018

I found that I can still drag something out from the URLBar even if I removed UIDragInteractionDelegate from it completely.

https://youtu.be/kZe_zYyYG1E

After removing the delegate, everything works except the content being dragged is empty.

Perhaps the text field provides a drag feature by default but it is broken by our URLBar implementation.

I think we should fix the bug that breaks the default drag feature and remove our UIDragInteractionDelegate implementation, instead of fixing our UIDragInteractionDelegate implementation.

@sblatz , how do you think?

P.S. I removed UIDragInteractionDelegate from URLBar by deleting

let dragInteraction = UIDragInteraction(delegate: self)
textAndLockContainer.addInteraction(dragInteraction)
and
extension URLBar: UIDragInteractionDelegate {
func dragInteraction(_ interaction: UIDragInteraction, itemsForBeginning session: UIDragSession) -> [UIDragItem] {
guard let url = url, let itemProvider = NSItemProvider(contentsOf: url) else { return [] }
let dragItem = UIDragItem(itemProvider: itemProvider)
Telemetry.default.recordEvent(category: TelemetryEventCategory.action, method: TelemetryEventMethod.drag, object: TelemetryEventObject.searchBar)
return [dragItem]
}
func dragInteraction(_ interaction: UIDragInteraction, previewForLifting item: UIDragItem, session: UIDragSession) -> UITargetedDragPreview? {
let params = UIDragPreviewParameters()
params.backgroundColor = UIColor.clear
return UITargetedDragPreview(view: draggableUrlTextView, parameters: params)
}
func dragInteraction(_ interaction: UIDragInteraction, sessionDidMove session: UIDragSession) {
for item in session.items {
item.previewProvider = {
guard let url = self.url else {
return UIDragPreview(view: UIView())
}
return UIDragPreview(for: url)
}
}
}
}

@sblatz
Copy link
Contributor

sblatz commented Oct 30, 2018

@tsekityam does removing the drag interaction still allow users to drag the URL when the text field is not active? I believe that's why I added that functionality (and overrode the default behavior).

@aritramullick
Copy link

Hey! is this still open? I am a beginner and would love to get involved in the open source community, but would require quite a bit of help.

@Keenuts
Copy link

Keenuts commented May 19, 2022

Hi there 👋

Is there a reason to close this issue?
It is still impossible to drag the cursor to edit part of the url on Firefox focus iOS (98.1), making modifying the beginning of URLs quite difficult.

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

No branches or pull requests

6 participants