Fix URL navigation and text alignment issues in inlineEditor.

Review Request #5238 — Created Jan. 12, 2014 and submitted

Information

Djblets
master

Reviewers

Fix URL navigation and text alignment issues in inlineEditor.

inlineEditor's dragged text detection on <a href="..."/> elements would
fail to prevent the default action of navigating to the page after
opening the editor. The mouseup was too late to block this. To fix this
properly, we now register a click event that directly opens the editor
and prevents the default action.

There were also issues with sizing the editor on elements with a custom
text-align property. It wasn't able to find the ideal bounds for the
editor, and would result in a pretty small text field just big enough
for the original text. It now works around this by setting the
text-align property of the parent to left while doing the calcuations,
restoring it afterward.

Tested with a change I have in progress that was affected by both of these
bugs.

Description From Last Updated

Can you elaborate on the motivation behind this for me? This change prevents users from clicking on a link in …

TG tgerdes
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
TG
  1. I don't know if it's appropriate for me to comment on an old review like this or if I should do this in the context of a bug, but I'll start here for now.

  2. djblets/static/djblets/js/jquery.gravy.inlineEditor.js (Diff revision 1)
     
     
     
     
     
     
    Show all issues

    Can you elaborate on the motivation behind this for me? This change prevents users from clicking on a link in the Description or Testing Done sections and having it open in a new tab.

    For example, in https://reviews.reviewboard.org/r/5465/ I posted a few links in testing done and clicking them (as a user who has no permission to edit my review request, which includes myself since it's in the closed state) causes absolutely nothing to happen now. -- They look like links but no longer behave like links.

    Is that your expected behavior now?

    1. This would best be done on a bug report. I believe there is a bug filed for this already though, but it'd be helpful to point to this code.

      Preventing the clicking of links is not expected behavior. This was added so that the events don't propagate down, disrupting other bits of code. It likely interferes with the Markdown editor we now use.

    2. OK. I'll look through the bugs. to see if I can find it.

      I suspect it is Bug 3377 , but I get a 500 error every time I try to open that to see more details. Maybe I'll file a dupe bug for you.

      Thanks for the response.

  3.