Code

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#17518 closed Bug (fixed)

Display of StackedInline has glitch with Firefox/Iceweasel (Gecko)

Reported by: sebastian Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords: comsetic, admin, stacked inline, glitch
Cc: sebastian.goll@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: yes

Description

Current trunk has the following cosmetic problem with StackedInline in the admin. Stacked fieldsets listed with a "Delete" checkbox don't get the full width of the form table on Firefox/Iceweasel (Gecko engine). The glitch happens at least with versions 8.0 and 9.0.1. It does not happen with Chromium 15.0 or Opera 11.60. The problem seems to be that the Gecko engine somehow decides to subtract the width of the "Delete" checkbox from the width of the fieldset below.

I'm attaching two screenshots to illustrate the problem. I'm also attaching a simple patch that fixes the issue, and which has no undesired side-effects on the two other browsers that I could test.

Attachments (5)

before.png (145.1 KB) - added by sebastian 2 years ago.
r17364-admin-inline-css.diff (398 bytes) - added by sebastian 2 years ago.
after.png (145.7 KB) - added by sebastian 2 years ago.
17518-firefox-working.png (84.3 KB) - added by julien 2 years ago.
17518-firefox-linux-not-working.png (42.4 KB) - added by sebastian 2 years ago.

Download all attachments as: .zip

Change History (18)

Changed 2 years ago by sebastian

Changed 2 years ago by sebastian

Changed 2 years ago by sebastian

comment:1 Changed 2 years ago by sebastian

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

PS: The glitch described here is not related to the inlining of thumbnails shown in the screenshots. It also happens with a vanilla project that contains nothing but a parent model and a related model inlined in the parent's admin page:

# models.py

class A(models.Model):
    pass

class B(models.Model):
    a = models.ForeignKey(A)
    b = models.CharField(max_length=200)

# admin.py

class BInline(admin.StackedInline):
    model = B

class AAdmin(admin.ModelAdmin):
    inlines = (BInline,)

admin.site.register(A, AAdmin)

comment:2 Changed 2 years ago by sebastian

  • Cc sebastian.goll@… added

comment:3 Changed 2 years ago by jezdez

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:4 Changed 2 years ago by julien

I can't seem to reproduce this error using Firefox 10.0.2. Could someone else confirm?

comment:5 Changed 2 years ago by sebastian

I just upgraded my local install of Firefox/Iceweasel to 10.0.2, and I'm still experiencing the same error. Note that it's the line between two different fields of the stacked inline model, not the line between "delete" and the first field, that's shorter than the row. (My simplified example above was misleading insofar as it requires an additional field c in B to properly reproduce the error as shown in the screenshots. I apologize.)

# models.py

class A(models.Model):
    pass

class B(models.Model):
    a = models.ForeignKey(A)
    b = models.CharField(max_length=200)
    c = models.CharField(max_length=200)

# admin.py

class BInline(admin.StackedInline):
    model = B

class AAdmin(admin.ModelAdmin):
    inlines = (BInline,)

admin.site.register(A, AAdmin)

I'm also using current trunk (r17547, 1.4b1).

comment:6 Changed 2 years ago by julien

Thanks for the updated code sample. However, I still can't reproduce the problem. See the attached screenshot. Am I missing something?

Changed 2 years ago by julien

comment:7 Changed 2 years ago by julien

Which OS are you using? I'm on Mac OSX.

comment:8 Changed 2 years ago by sebastian

Wow, that is strange. I'm running Linux (Debian wheezy/sid, Linux 3.2.0-1-amd64, X.Org 1.11.3.901). See the attached screenshot of the same admin view as yours, with the broken horizontal lines.

How do we proceed here? Is it an OS bug, an Xorg bug, a bug with Firefox/Iceweasel, a bug with the Gecko engine …? It is only a minor issue after all, so if we decide to not apply the proposed patch but rather blame the browser/OS combination, that'd be perfectly fine with me.

Has the proposed patch (one-liner) any unintended consequences? I.e. would it hurt to include it "just in case"?

Changed 2 years ago by sebastian

comment:9 Changed 2 years ago by claudep

Cannot reproduce the problem either: !Debian squeeze Iceweasel 9.0.1

comment:10 Changed 2 years ago by julien

I wonder what's causing that issue. Weird :)

The patch makes sense but it'd be useful to test on other browsers, in particular IE7+ which sometimes treat 'width:100%' in a different way.

comment:11 Changed 2 years ago by Aymeric Augustin

  • Resolution set to fixed
  • Status changed from new to closed

Fixed #17518 -- CSS glitch in StackedInline.

Thanks sebastian for the report and patch.

Changeset: 3dde02640c1bec4a2b34d12e6f92aa0a7f035227

comment:12 Changed 2 years ago by Aymeric Augustin

Fixed #17518 -- CSS glitch in StackedInline.

Thanks sebastian for the report and patch.

Changeset: 3dde02640c1bec4a2b34d12e6f92aa0a7f035227

comment:13 Changed 2 years ago by Aymeric Augustin

Fixed #17518 -- CSS glitch in StackedInline.

Thanks sebastian for the report and patch.

Changeset: 3dde02640c1bec4a2b34d12e6f92aa0a7f035227

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.