Alert the user when leaving the page while editing text.

Review Request #2437 — Created June 28, 2011 and submitted

Information

Review Board

Reviewers

Alert the user when leaving the page while editing text.

We were alerting the user when navigating away if a comment dialog was open
and being edited, but many users were wanting this for other fields too.

So now we alert the user if any text field is being edited, if the review
form is up, or if a comment dialog is dirty.
Tested various fields on the review request, in comment dialogs, and in the review form.

Whenever something was open/dirty, and I tried to navigate away, I got an alert.

I never got alerts after canceling/saving things and then navigating away.
Description From Last Updated

An issue may occur with ctrl-s. * Open to comment. * "ctrl-s" * Cancel or OK. Then the counter increment …

HO hongbin
david
  1. Ship It!
  2. 
      
HO
  1. Hi all.
    Just tried it in Chrome. Found some issues.
    * The confirm box didn't show correct message.
    * RB alerted me when I have no pending change.
    
    Steps to reproduce:
    1. commented on diff viewer.
    2. published reviews directly without going through review edit form.
    Then RB alerted me even I had no pending change. I think these issues just happened in Chrome, but worked very well in FF and IE.
  2. reviewboard/htdocs/media/rb/js/reviews.js (Diff revision 1)
     
     
     
     
    In Chrome, the confirm windows just showed true instead of error message. 
  3. 
      
HO
  1. Sorry for multiple reviews. I think this is a great feature, but we may want to avoid to alert users too much. Perfectly, RB should alert users if and only if necessary. Here is some suggest to improve.
    * Keep tracker of number of dirty fields instead of opened fields, although it will be harder to implement.
    * Publish review or reply should auto-save the right fields to reduce the chance to be alerted.
    * Discard review or reply should decrement the counter. Hopefully, the counter reach 0 without alert.
  2. An issue may occur with ctrl-s.
    * Open to comment.
    * "ctrl-s"
    * Cancel or OK.
    Then the counter increment once and decrement twice.
  3. 
      
Loading...