Limit table wrapping to configuration flag

We want to limit this behaviour on initial roll out to certain
wikis.

Bug: T330527
Change-Id: If73f6f3d182cc386ebf0e750206afdb05fd3d863
This commit is contained in:
Jon Robson 2024-05-29 15:35:45 -07:00
parent 03fd09ff1b
commit dba9e16be2
4 changed files with 16 additions and 2 deletions

View file

@ -118,6 +118,10 @@ Do not rely on any of the feature flags documented here. They should not be cons
- Note: The assumption is that A/B testing will always be occurring in this skin so would never be removed unlike the other flags.
- wgVectorWrapTablesTemporary
- When enabled, certain tables will be wrapped in a div to make them horizontally scrollable when no
space is available.
- Removal ticket: [https://phabricator.wikimedia.org/T361737](https://phabricator.wikimedia.org/T361737)
## Site-level Configuration

View file

@ -1,4 +1,5 @@
{
"@doc": "This file describes the shape of the AB config. It exists to support jest and TypeScript.",
"VectorSearchApiUrl": ""
"VectorSearchApiUrl": "",
"VectorWrapTablesTemporary": true
}

View file

@ -1,4 +1,8 @@
const config = require( './config.json' );
const init = () => {
if ( !config.VectorWrapTablesTemporary ) {
return;
}
const tables = document.querySelectorAll( '.mw-parser-output > table' );
Array.from( tables ).forEach( ( table ) => {
// Don't wrap tables within tables

View file

@ -433,7 +433,8 @@
{
"name": "resources/skins.vector.js/config.json",
"config": [
"VectorSearchApiUrl"
"VectorSearchApiUrl",
"VectorWrapTablesTemporary"
]
},
{
@ -571,6 +572,10 @@
]
},
"config": {
"VectorWrapTablesTemporary": {
"value": false,
"description": "@var bool temporary config variable for controlling role out of tables. When enabled certain tables will be wrapped with a div"
},
"VectorNightMode": {
"value": {
"logged_in": false,