1
0
mirror of https://github.com/django/django.git synced 2025-09-10 11:09:12 +00:00

Fixed #36556 -- Fixed TabularInline width overflowing the page.

This commit is contained in:
antoliny0919 2025-08-16 10:23:13 +09:00 committed by Sarah Boyce
parent 9efce80ca7
commit 3e7aedfb2e
3 changed files with 18 additions and 3 deletions

View File

@ -432,9 +432,12 @@ body.popup .submit-row {
border: none; border: none;
} }
.inline-related.tabular div.wrapper {
overflow-x: auto;
}
.inline-related.tabular fieldset.module table { .inline-related.tabular fieldset.module table {
width: 100%; width: 100%;
overflow-x: scroll;
} }
.last-related fieldset { .last-related fieldset {

View File

@ -15,7 +15,8 @@
</h2> </h2>
{% if inline_admin_formset.is_collapsible %}</summary>{% endif %} {% if inline_admin_formset.is_collapsible %}</summary>{% endif %}
{{ inline_admin_formset.formset.non_form_errors }} {{ inline_admin_formset.formset.non_form_errors }}
<table> <div class="wrapper">
<table>
<thead><tr> <thead><tr>
<th class="original"></th> <th class="original"></th>
{% for field in inline_admin_formset.fields %} {% for field in inline_admin_formset.fields %}
@ -62,7 +63,8 @@
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div>
{% if inline_admin_formset.is_collapsible %}</details>{% endif %} {% if inline_admin_formset.is_collapsible %}</details>{% endif %}
</fieldset> </fieldset>
</div> </div>

View File

@ -2501,6 +2501,16 @@ class SeleniumTests(AdminSeleniumTestCase):
tabular_inline.find_elements(By.CSS_SELECTOR, ".collapse"), tabular_inline.find_elements(By.CSS_SELECTOR, ".collapse"),
[], [],
) )
# The table does not overflow the content section.
content = self.selenium.find_element(By.ID, "content-main")
tabular_wrapper = self.selenium.find_element(
By.CSS_SELECTOR, "div.tabular.inline-related div.wrapper"
)
self.assertGreater(
tabular_wrapper.find_element(By.TAG_NAME, "table").size["width"],
tabular_wrapper.size["width"],
)
self.assertLessEqual(tabular_wrapper.size["width"], content.size["width"])
@screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"]) @screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"])
def test_tabular_inline_delete_layout(self): def test_tabular_inline_delete_layout(self):