Re: [Django] #35482: Email and URL form input widgets should always have dir="ltr"

76 views
Skip to first unread message

Django

unread,
May 27, 2024, 8:53:15 AM5/27/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Omid Shojaee):

From RFCs point of view, yes it is possible to use unicode characters in
username and password.

So I'd like to suggest an edit:

The ultimate solution would be to add an optional attribute, called "dir"
or "direction" to CharField, TextField, EmailField, URLField, UUIDField,
All Integer fields, FloatField and DecimanlField (numbers are always LTR),
GenericIPAddressField, FileField and ImageField (operating system paths
are always LTR) and leave it to the developers to decide the direction on
the field level.
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 27, 2024, 9:07:15 AM5/27/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce):

You can do this already by setting dir in the widget attrs
{{{
example_text = forms.CharField(widget=forms.TextInput(attrs={"dir":
"ltr"}))
}}}

If you don't think we should update any defaults for RTL to be LTR and the
developers should update on case by case, then I can close this as
wontfix?
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:7>

Django

unread,
May 27, 2024, 9:13:37 AM5/27/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Omid Shojaee):

I'm aware of that workaround and it involves some extra coding.
Furthermore, it doesn't work everywhere (one example is the login.html
template of django.contrib.auth.admin).

My suggestion helps developers to target one specific field easily, on the
model level, based on their requirements.
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:8>

Django

unread,
May 27, 2024, 9:31:00 AM5/27/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Omid Shojaee):

I'm completely wrong. Please proceed with "Email and URL form input
widgets should always have dir="ltr"
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:9>

Django

unread,
May 27, 2024, 9:35:51 AM5/27/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce):

Replying to [comment:6 Omid Shojaee]:
> ...UUIDField, All Integer fields, FloatField and DecimanlField (numbers
are always LTR), GenericIPAddressField, FileField and ImageField
(operating system paths are always LTR)

Perhaps these should be updated as well?
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:10>

Django

unread,
May 27, 2024, 10:04:33 AM5/27/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Claude Paroz):

In any case, having a forum thread with opinions from other RTL-language
developers would be welcome!
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:11>

Django

unread,
May 27, 2024, 12:38:17 PM5/27/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Omid Shojaee):

The perfect implementation would be:

* Email widget: Always LTR

* Always LTR for the following fields:

1. BigIntegerField
2. BinaryField
3. DecimalField
4. EmailField
5. FileField
6. FilePathField
7. FloatField
8. GenericIPAddressField
9. ImageField
10. IntegerField
11. JSONField (never worked with it. don't know how it is displayed in the
admin site)
12. PositiveBigIntegerField
13. PositiveIntegerField
14. PositiveSmallIntegerField
15. SmallIntegerField
16. URLField
17. UUIDField

* And, optional "dir" attribute for CharField and TextField in case
someone needs it.

I believe the above will totally eliminate the need to override model
forms just to add proper direction.
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:12>

Django

unread,
Jun 19, 2024, 2:43:00 PM6/19/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Moe):

* Attachment "Screenshot from 2024-06-19 21-39-56.png" added.

--
Ticket URL: <https://code.djangoproject.com/ticket/35482>

Django

unread,
Jun 19, 2024, 2:45:47 PM6/19/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Moe):

Hi!

I could be wrong, but I think changing the default writing direction for
such fields can be somewhat tricky for RTL languages. As an Arabic-
speaking user, if I were to go to the Arabic version of a website, then
I'd expect form inputs to be RTL.

Most websites do that (since when you set dir="rtl" on the <html> tag, the
form inputs will automatically start from the right), so I expect the
default behavior of other websites to follow that as well.

Moreover, I think mixing writing directions of multiple form inputs won't
be quite nice (visually speaking, again, and I could be wrong). As you can
see in the screenshot, the text inputs are RTL, the email and password are
LTR, and it's a bit unappealing.
[[Image(Screenshot from 2024-06-19 21-39-56.png)]]
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:13>

Django

unread,
Jun 19, 2024, 2:57:51 PM6/19/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Omid Shojaee):

This ticket is about the Admin site. When you create your own forms you're
free to set the direction as you prefer.
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:14>

Django

unread,
Jun 24, 2024, 4:03:32 AM6/24/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce):

Replying to [comment:13 Moe]:
> Most websites do that (since when you set dir="rtl" on the <html> tag,
the form inputs will automatically start from the right)...

Thank you for raising this. How do you feel with `text-align: right`
together with `dir="ltr"` which means the cursor still moves left to right
but the visuals stay roughly the same?


Replying to [comment:14 Omid Shojaee]:
> This ticket is about the Admin site

I don't think this is admin specific as we would likely update form
widgets that are used outside the admin
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:15>

Django

unread,
Jun 24, 2024, 2:00:48 PM6/24/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Omid Shojaee):

I don't think this is admin specific as we would likely update form
widgets that are used outside the admin

That's fine. We still have control.
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:16>

Django

unread,
Aug 8, 2024, 7:17:54 AM8/8/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: SOUMITRA-
| SAHA
Type: Bug | Status: assigned
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by SOUMITRA-SAHA):

* cc: SOUMITRA-SAHA (added)
* owner: nobody => SOUMITRA-SAHA
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:17>

Django

unread,
Aug 24, 2024, 8:27:22 PM8/24/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: SOUMITRA-
| SAHA
Type: Bug | Status: assigned
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Mike Edmunds):

Replying to [comment:5 Sarah Boyce]:
> I believe emails only accept ascii characters

Just to clarify, Django has long supported non-ASCII domains in email
addresses, in the email validator and throughout django.core.mail.

But since every email address must end with an ASCII top level domain,
perhaps "Email widget: Always LTR" still makes sense? (I'm not an RTL
user, so don't know what the expectation would be for mixed RTL+LTR
addresses.)

(Also, RFC 6532 allows non-ASCII on both sides of the @, though neither
Django's email validator nor its SMTP email backend currently handle non-
ASCII before the @.)
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:18>

Django

unread,
Aug 30, 2024, 1:14:17 PM8/30/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner: (none)
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by SOUMITRA-SAHA):

* owner: SOUMITRA-SAHA => (none)
* status: assigned => new

--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:19>

Django

unread,
Sep 4, 2024, 4:18:17 AM9/4/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner:
| AdityaS8804
Type: Bug | Status: assigned
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by AdityaS8804):

* owner: (none) => AdityaS8804
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:20>

Django

unread,
Sep 4, 2024, 9:25:19 AM9/4/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner:
| AdityaS8804
Type: Bug | Status: assigned
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by AdityaS8804):

Hey,
So a valid solution to solve this would be to implement these in Forms
1) Implement dir="ltr" for relevant form fields in Django's admin.
2) Make LTR the default for certain field types like EmailField, URLField,
and various numeric fields.
3) Add an optional "dir" attribute to fields like CharField and TextField,
which allows control over text direction on a field-by-field basis.

Or am I missing anything?
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:21>

Django

unread,
Sep 4, 2024, 11:56:48 AM9/4/24
to django-...@googlegroups.com
#35482: Email and URL form input widgets should always have dir="ltr"
-------------------------------------+-------------------------------------
Reporter: Omid Shojaee | Owner:
| AdityaS8804
Type: Bug | Status: assigned
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: LTR, RTL, Admin, | Triage Stage: Accepted
accessibility |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Omid Shojaee):

I believe the most effective approach is to just add an optional "dir"
attribute to all model fields.
--
Ticket URL: <https://code.djangoproject.com/ticket/35482#comment:22>
Reply all
Reply to author
Forward
0 new messages