From: Vanessa Valderrama Date: Thu, 20 Mar 2025 17:19:17 +0000 (-0500) Subject: feat: Add sticky table-column X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F34%2F73434%2F1;p=releng%2Fdocs.git feat: Add sticky table-column This commit introduces a feature to add a sticky first column to tables generated from the list-table directive in Sphinx. The first column now remains fixed during horizontal scrolling, enhancing the user experience and improving readability, especially for long tables such as the one in infra/inventory.rst. The implementation uses CSS with `position: sticky`. The CSS is added to _static/css/sticky-table-column.css and included in the Sphinx build via conf.py. Change-Id: Ie68a3524bc34c38149e85c86ed4ea0d8a5f09ffe Signed-off-by: Vanessa Valderrama --- diff --git a/docs/_static/css/sticky-table-column.css b/docs/_static/css/sticky-table-column.css new file mode 100644 index 0000000..0304371 --- /dev/null +++ b/docs/_static/css/sticky-table-column.css @@ -0,0 +1,13 @@ +.rst-content .list-table table td:nth-child(1) { + position: sticky; + left: 0; + background-color: white; + z-index: 1; +} + +.rst-content .list-table table th:nth-child(1) { + position: sticky; + left: 0; + background-color: white; + z-index: 2; +} diff --git a/docs/conf.py b/docs/conf.py index 1070d7f..c68a23b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,3 +48,4 @@ sphinx_tabs_valid_builders = ["linkcheck"] def setup(app): """Injects the report issue ribbon.""" app.add_css_file("css/ribbon.css") + app.add_css_file("css/sticky-table-column.css")