Closed
Bug 98160
Opened 23 years ago
Closed 13 years ago
Replace Accel+Shift+X (Switches text direction) with more intuitive keyboard shortcuts: Ctrl+Left/Right Shift on Windows
Categories
(Core :: DOM: Editor, enhancement)
Core
DOM: Editor
Tracking
()
RESOLVED
FIXED
mozilla9
People
(Reporter: xslf, Assigned: ehsan.akhgari)
References
(Depends on 1 open bug)
Details
(6 keywords, Whiteboard: see comment 17)
Attachments
(2 files, 4 obsolete files)
(deleted),
text/html
|
Details | |
(deleted),
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.3+) Gecko/20010831 BuildID: 2001083103 in windows systems, left ctrl+shift changes alignment/directionality to LTR and right ctrl+shift changes alignment/directionality to RTL. This is a standard feature, that works in almost all windows applications. However, it does not work in textarea under Mozilla Reproducible: Always Steps to Reproduce: 1. Load any form with textarea into Mozilla (you can use the attached one) 2. Use Left ctrl + shift or right ctrl + shift to change the alignment/directionality Actual Results: Nothing happends Expected Results: The alignment/directionality should change Lots of Isralie web sites depend on this feature in there web forms. It is very common to see directions telling the user to use this method if they wish to write in the other langues (Hebrew or English). With this feature missing, it is a real pain to right English in RTL forms, and Hebrew in LTR forms. BTW, this is not limited to textareas- almost no dialog boxes in Mozilla respond to this, which makes creating Hebrew folder names for bookamrs, editing Hebrew bookmark names etc. a real pain.
Reporter | ||
Comment 1•23 years ago
|
||
![]() |
||
Updated•23 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Reporter | ||
Comment 2•23 years ago
|
||
I discovered the same problem with Mozilla mail- you can't set plain text mail to right-to-left, which makes it a real pain to read/write Hebrew email. Should I open a separete bug for it?
Comment 3•23 years ago
|
||
Yes, please do open a separate RFE bug for directionality in mail. It was discussed as a side issue in bug 95371, and is on my personal TODO list, but it deserves its own bug.
Comment 4•23 years ago
|
||
Assigning to myself to get on intl nsbeta1 radar. mkaply, feel free to do the same with any other bugs that are currently assigned to you, if appropriate.
Assignee: mkaply → smontagu
Keywords: nsbeta1
Comment 5•23 years ago
|
||
nsbeta1- too late for unknown issue.
Updated•23 years ago
|
Status: NEW → ASSIGNED
Comment 6•22 years ago
|
||
batch: adding topembed per Gecko2 document http://rocknroll.mcom.com/users/marek/publish/Gecko/Gecko2Tasks.html
Keywords: topembed
Updated•22 years ago
|
Comment 7•22 years ago
|
||
The bugreport was initially submitted for a windows system.... But i would rather like this feature be introduced in mozilla-linux, too. The textareas as well as regular <input type="text" ..> are hardly usable on all systems when dir="rtl" secified for them in the document.
Comment 8•22 years ago
|
||
Please change the title of this bug to "Can't change alignment/directionality in a textarea" and mark this as a problem for all operating systems and all platforms. The Ctrl+Shift shortcut is only valid for Windows, but the problem affects everyone - including users of operating systems without native Hebrew support (such as BeOS and most unices). When Bug 85420 ("Need Bidi UI") is solved we'll have a reasonable solution, but a keyboard shortcut will definitely be a welcomed addition to Mozilla users on platforms other than Windows. Prog.
Reporter | ||
Updated•22 years ago
|
Depends on: bidiui
OS: Windows 98 → All
Hardware: PC → All
Summary: Can't change alignment/directionality in a textarea using ctrl shift → Can't change alignment/directionality in a textarea
a textarea
Reporter | ||
Updated•22 years ago
|
Summary: Can't change alignment/directionality in a textarea
a textarea → Can't change alignment/directionality in a textarea
Comment 9•22 years ago
|
||
Jesse Ruderman from squarefree.com made for us a quick direction switcher for textareas, which has a bookmarklet installation. javascript:(function(){var D=document,B=D.body,sx=B.scrollLeft,sy=B.scrollTop,k,i,f,j,x,r,p,a;for(i=0;f=D.forms[i];++i)for(j=0;x=f[j];++j)x.onblur=function(){for(p=k=this;p&&!p.dir;p=p.parentNode);r=p?(p.dir=="rtl"):0;k.dir=(r?"ltr":"rtl");};a=D.createElement("a");a.href="#";B.appendChild(a);a.focus();setTimeout(function(){for(i=0;f=D.forms[i];++i)for(j=0;x=f[j];++j)x.onblur=null;if(k)k.focus();else alert("No focused textbox!");B.removeChild(a);B.scrollLeft=sx;B.scrollTop=sy;},0)})() Still, we have another two workarounds, which have been discussed here and at mozilla.org.il (hebrew): A. Ilya Konstantinov's - http://toast.unwind.co.il/hacks/mozBidiBindings-0.3.tar.gz - No automatic installation, XBL based. B. Mooffie's - http://archive.takilla.com/SiteBuilders/msg01342.html (Hebrew, but still readable) - One line addition to platformHTMLBindings.xml, shorter, no automatic installation. Now if we will get the ability to bind ctrl-shift to one of those...
Reporter | ||
Comment 10•22 years ago
|
||
From Comment #9: >Jesse Ruderman from squarefree.com made for us a quick direction switcher for >textareas, which has a bookmarklet installation. This doesn't seem to work with Camino :-(
Comment 11•22 years ago
|
||
Btw, you have to put that bookmarklet on your bookmarks toolbar to use it; you can't use it directly from the address bar. That's because it depends on a textbox or textarea being focused. If Camino makes the bookmarks toolbar take focus when you click a bookmarklet, you can use a bookmarklet that does one of the following instead: - changes direction of all textareas. - adds the ctrl+shift shortcut for the current page. - changes the cursor and waits for you to click the textarea you want to change.
Reporter | ||
Comment 12•22 years ago
|
||
Hmm.. restarted the browser and now it seems to work. Perhaps it was a fluke.
>adds the ctrl+shift shortcut for the current page
As far as I know, that shortcut is windows only. Camino runs on mac OS. Am I
mistaken here?
Reporter | ||
Comment 13•21 years ago
|
||
*** Bug 223001 has been marked as a duplicate of this bug. ***
Comment 14•21 years ago
|
||
*** Bug 240243 has been marked as a duplicate of this bug. ***
Comment 15•20 years ago
|
||
*** Bug 247021 has been marked as a duplicate of this bug. ***
Comment 16•20 years ago
|
||
Solution: http://bidiui.mozdev.org
Comment 17•20 years ago
|
||
"Switch Text Direction" menu item (see bug 85420) has been checked in for Firefox, and will be checked in soon for Seamonkey. The current keyboard shortcut is Accel+Shift+Y. We know it is bad, but because of bug 166240 we can't implement ctrl+right/left shift at the moment. As crtl+shift is windows-only standard, I suggest ctrl (not accel)+right/left arrows on other platforms. (as far as I know, only on windows ctrl+arrows select a word in textareas, correct me if i'm wrong).
Severity: normal → enhancement
Depends on: 166240
QA Contact: zach → bugs.mano
Summary: Can't change alignment/directionality in a textarea → Replace Accel+Shift+Y (Switches text direction) with more intuitive keyboard shortcuts: Ctrl+Left/Right Shift on Windows, Ctrl (not accel)+arrows on other platforms
Whiteboard: see comment 17
Updated•20 years ago
|
Comment 18•20 years ago
|
||
Ctrl+Left/Right arrow jumps to the previous/next word in a textarea on Linux/GTK2 as well. Add Shift to extend a selection.
Updated•20 years ago
|
Summary: Replace Accel+Shift+Y (Switches text direction) with more intuitive keyboard shortcuts: Ctrl+Left/Right Shift on Windows, Ctrl (not accel)+arrows on other platforms → Replace Accel+Shift+X (Switches text direction) with more intuitive keyboard shortcuts: Ctrl+Left/Right Shift on Windows / Linux ; Ctrl (not accel)+arrows on OS X
Updated•20 years ago
|
Depends on: dom3_events
Comment 19•19 years ago
|
||
*** Bug 321687 has been marked as a duplicate of this bug. ***
Comment 20•18 years ago
|
||
Possible solution here: http://eesh.net/MozCtrlShift.html I have no idea if this is relevant for XUL, I hope it helps. This is, of course, just a proof of concept. Demonstrated on a textarea, works on an input (type=text) too.
Comment 21•18 years ago
|
||
See progress of implementing this in an extention in: http://bugzilla.mozdev.org/show_bug.cgi?id=15075
Comment 22•16 years ago
|
||
Chromium is gaining users and have recently got ctrl-shift change direction support in its nightlies. Please implement this in Gecko, so we will be able to get rid of the ctrl-shift-x hotkey and the 'switch direction' context menu item.
Updated•15 years ago
|
QA Contact: mano → keyboard.navigation
Comment 24•14 years ago
|
||
Several times recently (using FF 3.6.6 on OSX 10.6.4) I've enabled RTL by mistake, probably because the current shortcut is so close to Cut (Cmd-X). The lack of context menu makes the mistake difficult to rectify. In the end, I resorted to google, and found this page: http://support.mozilla.com/en-US/kb/Text+entered+into+Firefox+is+backwards The proposed Ctrl-left/right sequence still seems prone to accidents (e.g. if using Alt-left/right to cursor across words). It makes me wonder: should this feature really be enabled for all locales by default? I don't know what percentage of Firefox users want this feature, but I expect they are small minority, and highly localised. I think it would make sense to have a preference for "Fast RTL toggle", which would be disabled by default for most locales.
Comment 25•14 years ago
|
||
Do you have any news about this bug? Do you plan to implement the Ctrl+Left/Right Shift for switching text direction ? Please let me know Thanks
Comment 26•13 years ago
|
||
Comment 27•13 years ago
|
||
Hello, Please find in attachment a patch for fixing the problem on Windows/Linux In this pacth the direction of the text is changed upon Ctrl+Shift key pressing Please observe that no distinction is made between Right Ctrl+Shift and Left Ctrl+Shift. It seems even impossible to implement (at least by looking at the following article: http://stackoverflow.com/questions/2847135/check-ctrl-shift-alt-keys-on-click-event). Please let me know your commnents/suggestions
Comment 28•13 years ago
|
||
How do you install the patch. Clicking on the attachment simply shows a page of JS code
Comment 29•13 years ago
|
||
Comment 30•13 years ago
|
||
Sorry. I have not generated the patch from the top level directory. Now I guess you can install the patch by running the following command from the top level directory: patch -p0 < <the attached patch>
Comment 31•13 years ago
|
||
Assignee | ||
Comment 32•13 years ago
|
||
The current shortcut keys are implemented here: <http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser-sets.inc#346>. But XUL <key> elements do not support events for ctrl+alt, which is sad... Gavin, what do you think would be the acceptable solution here?
Comment 33•13 years ago
|
||
You can use my workaround suggested in comment 20...
Comment 34•13 years ago
|
||
Any comments about the patch I posted a week ago ?
Comment 35•13 years ago
|
||
Hey, this bug is more than ten years old (!!!). Let's fix it already.
Assignee | ||
Comment 36•13 years ago
|
||
wajnberg@il.ibm.com, I'm terribly sorry that I missed your earlier comments and patches on this bug. While your general approach works, the correct fix is a bit more involved here. Specifically, Ctrl+Left/Right Shift is a Windows only key combination, and it should only be handled if there are bidi keyboards installed on the system. Also, this combination is not a mere toggle, if the left shift key is pressed, the direction should be switched to LTR, and if the right shift is pressed, it should be switched to RTL (thanks to Microsoft for coming up with this really complicated detail!). I'm morphing this bug to be only about Windows. For other platforms, we should file separate bugs if we find out about existing platform conventions. I wrote a patch tonight to add this support, which I will attach shortly. I wrote it on a Mac, so it's totally untested (it may not even compile!). I'll submit it for review when I test it and make sure that it works as expected.
Assignee: mano → nobody
Component: Keyboard: Navigation → Editor
Summary: Replace Accel+Shift+X (Switches text direction) with more intuitive keyboard shortcuts: Ctrl+Left/Right Shift on Windows / Linux ; Ctrl (not accel)+arrows on OS X → Replace Accel+Shift+X (Switches text direction) with more intuitive keyboard shortcuts: Ctrl+Left/Right Shift on Windows
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → ehsan
Keywords: dev-doc-needed,
user-doc-needed
QA Contact: keyboard.navigation → editor
Assignee | ||
Comment 37•13 years ago
|
||
Attachment #529456 -
Attachment is obsolete: true
Attachment #529655 -
Attachment is obsolete: true
Attachment #529719 -
Attachment is obsolete: true
Assignee | ||
Comment 38•13 years ago
|
||
For future reference, I came across this Chromium patch <http://src.chromium.org/viewvc/chrome?view=rev&revision=13588>, and I used some implementation ideas and code from the Chromium project, which I've specified in the patch itself. Not sure if I need to add anything to about:license for this usage.
Assignee | ||
Comment 39•13 years ago
|
||
OK, this version of the patch actually compiles, and works just fine!
Attachment #560294 -
Attachment is obsolete: true
Attachment #560299 -
Flags: review?(roc)
Comment 40•13 years ago
|
||
(In reply to Ehsan Akhgari [:ehsan] from comment #36) > Also, this combination is not a mere toggle, if > the left shift key is pressed, the direction should be switched to LTR, and > if the right shift is pressed, it should be switched to RTL (thanks to > Microsoft for coming up with this really complicated detail!). I find it difficult to use both key combinations, and sometimes find myself unable to change the direction because my right hand is actually used for the mouse movement. If I remember correctly, it was added only to more recent versions of Windows and before that it used to be a toggle key. If it doesn't take too much, I'd prefer if we can change this behavior using a preference or by an extension.
Comment on attachment 560299 [details] [diff] [review] Patch (v1) Review of attachment 560299 [details] [diff] [review]: ----------------------------------------------------------------- ::: editor/libeditor/base/nsEditorEventListener.cpp @@ +395,5 @@ > + } else { > + return false; > + } > + > + // Scan the key status to find pressed keys. We should adandon changing the abandon @@ +459,5 @@ > + if (keyCode == nsIDOMKeyEvent::DOM_VK_SHIFT) { > + bool switchToRTL; > + if (IsCtrlShiftPressed(switchToRTL)) { > + mShouldSwitchTextDirection = PR_TRUE; > + mSwitchToRTL = switchToRTL ? PR_TRUE : PR_FALSE; just mSwitchToRTL = switchToRTL;
Attachment #560299 -
Flags: review?(roc) → review+
Comment 42•13 years ago
|
||
Try run for 0c2293268a6d is complete. Detailed breakdown of the results available here: http://tbpl.allizom.org/?tree=Try&usebuildbot=1&rev=0c2293268a6d Results (out of 171 total builds): exception: 3 success: 145 warnings: 7 failure: 16 Builds available at http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/eakhgari@mozilla.com-0c2293268a6d
Assignee | ||
Comment 43•13 years ago
|
||
(In reply to Tomer Cohen :tomer from comment #40) > (In reply to Ehsan Akhgari [:ehsan] from comment #36) > > Also, this combination is not a mere toggle, if > > the left shift key is pressed, the direction should be switched to LTR, and > > if the right shift is pressed, it should be switched to RTL (thanks to > > Microsoft for coming up with this really complicated detail!). > > I find it difficult to use both key combinations, and sometimes find myself > unable to change the direction because my right hand is actually used for > the mouse movement. If I remember correctly, it was added only to more > recent versions of Windows and before that it used to be a toggle key. If it > doesn't take too much, I'd prefer if we can change this behavior using a > preference or by an extension. For now, I would rather us be compatible with the platform conventions. Note that the existing shortcut (Ctrl+Shift+X) is being preserved.
Assignee | ||
Comment 44•13 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/66db4ae2f2c7
Flags: in-litmus?
Target Milestone: --- → mozilla9
Comment 45•13 years ago
|
||
For licensing: ideally, keep copied code in new files, but if not, make sure it's clearly marked. Add the name of the file or (if a whole directory) the name of the directory to the appropriate stanza in about:license. Gerv
Assignee | ||
Comment 46•13 years ago
|
||
I added the appropriate information to about:license: https://hg.mozilla.org/integration/mozilla-inbound/rev/67ad7402608f
Comment 47•13 years ago
|
||
For reference, note that Qt also uses Ctrl+Shift the way Windows does, that is, the left pair changes the field to LTR (and left aligned) and the right pair to RTL (right aligned). Qt only enables this when you enable support for RTL languages. I don't know if GTK+ has a similar convention, but the Qt one, added to the fact that most Linux users (at least here in Israel) are well aware of Windows conventions, makes me think that Mozilla should adapt a similar behavior on Linux too.
Assignee | ||
Comment 48•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/66db4ae2f2c7 https://hg.mozilla.org/mozilla-central/rev/67ad7402608f
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 49•13 years ago
|
||
(In reply to shai from comment #47) > For reference, note that Qt also uses Ctrl+Shift the way Windows does, that > is, the left pair changes the field to LTR (and left aligned) and the right > pair to RTL (right aligned). Qt only enables this when you enable support > for RTL languages. > > I don't know if GTK+ has a similar convention, but the Qt one, added to the > fact that most Linux users (at least here in Israel) are well aware of > Windows conventions, makes me think that Mozilla should adapt a similar > behavior on Linux too. Please file a bug to add this support to Qt. I don't know a lot about the Qt APIs myself, so I would appreciate some help there. :-)
Comment 50•13 years ago
|
||
From attachment 560299 [details] [diff] [review] [1] I understand that this fix is intended for Windows only. Will we have to keep using the other key binding under Linux and Mac? I understood previously that we intended to fix this bug when DOM3 events will get implemented in Gecko. Since this fix is not based on DOM3 (Am I right?), does it mean that we will prefer to remove this additional code in the future? [1] https://bugzilla.mozilla.org/attachment.cgi?id=560299&action=diff#a/editor/libeditor/base/nsEditorEventListener.h_sec1
Assignee | ||
Comment 51•13 years ago
|
||
(In reply to Tomer Cohen :tomer from comment #50) > From attachment 560299 [details] [diff] [review] I understand that this > fix is intended for Windows only. Will we have to keep using the other key > binding under Linux and Mac? Yes, this fix is Windows only. I talked to Behdad about how GTK handles text direction change, and he told me that the way that GTK works natively is that when changing the keyboard layout, if the text field doesn't contain any characters with a strong direction, its direction is automatically switched to the direction of the keyboard layout, which is a behavior that I think is a lot more intuitive than what we have in Windows. He also told me that we need to use _gdk_x11_keymap_state_changed in order to get notified when the keyboard layout changes. So we can file a bug to do this on GTK. For Mac, I'm not personally aware of any native keybindings for text control direction change. Do you know of any? > I understood previously that we intended to fix this bug when DOM3 events > will get implemented in Gecko. Since this fix is not based on DOM3 (Am I > right?), does it mean that we will prefer to remove this additional code in > the future? Well, the solution that I implemented works today! :-) When we get enough support in DOM3 so that we can avoid using Win32 API, we can remove that code. But still I think that we want to emulate platform native behavior here, instead of adding Ctrl+Shift on all platforms. Do you know of any other Linux/Mac app which handles the Ctrl+Shift keyboard toggle to direction of text controls?
Comment 52•13 years ago
|
||
Umm, sorry to chime in this late, I was only following dependent bugs. But I would still hope Ehsan or others could answer a couple of questions. - Is it now the case that Right-Shift can be told apart from Left-Shift? - If not, how does the patch code differ (if it at all differs) from the Ctrl+Shift direction switching logic in BiDi Mail UI? i.e. the finite-state machine described here: http://www.mozdev.org/source/browse/bidiui/source/tbird/chrome/content/bidimailpack/bidimailpack-composer.js?rev=1.183 (line 12)
Assignee | ||
Comment 53•13 years ago
|
||
(In reply to Eyal Rozenberg from comment #52) > Umm, sorry to chime in this late, I was only following dependent bugs. But I > would still hope Ehsan or others could answer a couple of questions. > > - Is it now the case that Right-Shift can be told apart from Left-Shift? Not using the DOM APIs yet. I just used the Win32 API for doing that. > - If not, how does the patch code differ (if it at all differs) from the > Ctrl+Shift direction switching logic in BiDi Mail UI? i.e. the finite-state > machine described here: > http://www.mozdev.org/source/browse/bidiui/source/tbird/chrome/content/ > bidimailpack/bidimailpack-composer.js?rev=1.183 > (line 12) It differs to that logic in two ways: 1. It doesn't implement Ctrl+Shift as a direction toggle switch, it implements the Windows behavior of differentiating between right and left shift keys. 2. It only implements this behavior on systems with at least two keyboard layouts of different directions, to be compatible with Windows.
Comment 54•13 years ago
|
||
(In reply to Ehsan Akhgari [:ehsan] from comment #49) > (In reply to shai from comment #47) > > For reference, note that Qt also uses Ctrl+Shift the way Windows does, that > > is, the left pair changes the field to LTR (and left aligned) and the right > > pair to RTL (right aligned). Qt only enables this when you enable support > > for RTL languages. > > > > I don't know if GTK+ has a similar convention, but the Qt one, added to the > > fact that most Linux users (at least here in Israel) are well aware of > > Windows conventions, makes me think that Mozilla should adapt a similar > > behavior on Linux too. > > Please file a bug to add this support to Qt. I don't know a lot about the > Qt APIs myself, so I would appreciate some help there. :-) I seem to have been misunderstood: The intention was not "I need something like this in Qt", it was "Qt already has this, please copy their feature into mozilla". I see by comment #51 that there is no intention to do this (on Linux); I think that's a pity, but, oh well. Thank you for fixing the problem on Windows.
Comment 55•13 years ago
|
||
For the record, OpenOffice also implemented this keyboard shortcut on all three major platforms.
Assignee | ||
Comment 56•13 years ago
|
||
I filed bug 689246 for the Qt implementation.
Comment 57•13 years ago
|
||
Documentation updated: https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIBidiKeyboard Also mentioned on Firefox 9 for developers.
Keywords: dev-doc-needed → dev-doc-complete
Comment 58•13 years ago
|
||
Hi, I can not use "right ctrl+shift" in last Firefox Nightly (11.0a1 (2011-11-17)). Is it disabled because I could use this feature around one week ago but now I can not and I must use ctrl+shift+x in Firefox (still I can use this shortkey on chrome or other windows programs) Thank you.
Comment 59•13 years ago
|
||
Sorry, now working again, thanks :)
Assignee | ||
Updated•12 years ago
|
Flags: in-litmus?
You need to log in
before you can comment on or make changes to this bug.
Description
•