<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>49107</bug_id>
          
          <creation_ts>2010-11-05 15:58:14 -0700</creation_ts>
          <short_desc>In HOME/END operations, cursor goes wrong direction in mixed RTL-LTR</short_desc>
          <delta_ts>2025-12-26 12:40:34 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>HTML Editing</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc>https://bug-25298-attachments.webkit.org/attachment.cgi?id=29619</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Xiaomei Ji">xji</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>aharon</cc>
    
    <cc>ahmad.saleem792</cc>
    
    <cc>bugs</cc>
    
    <cc>changseok</cc>
    
    <cc>fantasai.bugs</cc>
    
    <cc>mitz</cc>
    
    <cc>playmobil</cc>
    
    <cc>rniwa</cc>
    
    <cc>uriber</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>305600</commentid>
    <comment_count>0</comment_count>
      <attachid>73132</attachid>
    <who name="Xiaomei Ji">xji</who>
    <bug_when>2010-11-05 15:58:14 -0700</bug_when>
    <thetext>Created attachment 73132
Example of mixed RTL+LTR in an RTL context

This is split from issue 37884.


Steps to Reproduce:


1) Make an editable RTL element with mixed RTL+LTR text in it.

e.g. &lt;input type=&quot;text&quot; style=&quot;direction: rtl;&quot; size=&quot;40&quot; value=&quot;&amp;#1513;&amp;#1464;&amp;#1473;&amp;#1500;&amp;#1493;&amp;#1465;&amp;#1501;hello&quot;/&gt;


2) Put your cursor in the Hebrew text, which is correctly at the right hand beginning side of the text.


3) Press END


Actual Result:

- The cursor jumps to the *beginning* of &quot;hello&quot; at the far left side of all the text


Expected Result:

- The cursor jumps to the *end* of &quot;hello&quot;, which is in the middle visually, between the RTL and the LTR.
- FF, IE and RTL Windows in general appear to get this right</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>305604</commentid>
    <comment_count>1</comment_count>
    <who name="Xiaomei Ji">xji</who>
    <bug_when>2010-11-05 16:01:52 -0700</bug_when>
    <thetext>*** Bug 37884 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>320500</commentid>
    <comment_count>2</comment_count>
    <who name="Xiaomei Ji">xji</who>
    <bug_when>2010-12-10 16:33:50 -0800</bug_when>
    <thetext>I am not sure what is the correct/expected behavior.

Following is from Aharon:

&quot;Re the visual position after Home and End, I am not sure that there is a really &quot;correct&quot; way to do it. There are good reasons for either approach. BTW, Opera does it like IE, even though it has visual arrow key movements. But what WebKit and Firefox are doing is fine.&quot;.

I just read the draft specs for bidi editing by Matitiahu Allouche of IBM, the chairman of the Standards Institute of Israel&apos;s committee on IT aspects of Hebrew.
On &quot;HOME/END&quot; issue it says:
&quot;Home and End keys are logical functions which move the current logical position before the first logical character (whatever its Bidi level) and after the last logical character (of the line, sentence, paragraph etc... according to whatever unit of text the non-bidi Home and End functions relate to).
The caret will be displayed on the leftmost visual position for Home in LTR paragraphs and End in RTL paragraphs, on the rightmost visual position for End in LTR paragraphs and Home in RTL paragraphs. Beside moving the caret position, Home and End must set the caret direction in accordance with the base direction of the the paragraph.&quot;

Which matches our current implementation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2168275</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-12-26 12:34:26 -0800</bug_when>
    <thetext>&lt;rdar://problem/167214189&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2168276</commentid>
    <comment_count>4</comment_count>
    <who name="fantasai">fantasai.bugs</who>
    <bug_when>2025-12-26 12:40:34 -0800</bug_when>
    <thetext>https://bug-25298-attachments.webkit.org/attachment.cgi?id=29619 is a good testcase for this fwiw.

AFAICT our implementation matches the description in https://bugs.webkit.org/show_bug.cgi?id=49107#c2 and also matches the behavior in Pages... I think that means we should close this bug as working as intended?

That said, because Apple maps Home onto the Left arrow key and End onto the Right arrow key... it&apos;s a bit awkward. The left arrow goes left, except Fn+Left goes right...</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>73132</attachid>
            <date>2010-11-05 15:58:14 -0700</date>
            <delta_ts>2010-11-05 15:58:14 -0700</delta_ts>
            <desc>Example of mixed RTL+LTR in an RTL context</desc>
            <filename>home-end.html</filename>
            <type>text/html</type>
            <size>340</size>
            <attacher name="Xiaomei Ji">xji</attacher>
            
              <data encoding="base64">PGh0bWw+Cjxib2R5PgoKPHA+UlRMIGNvbnRleHQ8L3A+Cgo8Zm9ybT4KPGlucHV0IHR5cGU9InRl
eHQiIHN0eWxlPSJkaXJlY3Rpb246IHJ0bDsiIHNpemU9IjQwIiB2YWx1ZT0iJiMxNTEzOyYjMTQ2
NDsmIzE0NzM7JiMxNTAwOyYjMTQ5MzsmIzE0NjU7JiMxNTAxO2hlbGxvIi8+CjwvZm9ybT4KCjxw
PkxUUiBjb250ZXh0PC9wPgoKPGZvcm0+CjxpbnB1dCB0eXBlPSJ0ZXh0IiBzdHlsZT0iZGlyZWN0
aW9uOiBsdHI7IiBzaXplPSI0MCIgdmFsdWU9ImhlbGxvJiMxNTEzOyYjMTQ2NDsmIzE0NzM7JiMx
NTAwOyYjMTQ5MzsmIzE0NjU7JiMxNTAxOyIvPgo8L2Zvcm0+CgoKPC9ib2R5Pgo8L2h0bWw+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>