Wikipedia:Text reactions

Text reactions is a proposed software feature or gadget that enables the editor to react to what the user enters in the editing area. It was initially suggested as part of Making editing easier 2021. Comments and suggestions are much welcome on the talk page.

Capabilities
A work-in-progress prototype is available at User:SD0001/text-reactions.js.

Text reactions are configured as a list of checks which are triggered in different ways:

Triggers

 * Time interval: Invoked every N seconds unconditionally.
 * Keypress: Every time a given key is pressed (powered by JS keyup event).
 * Word entry: Every time a given word is entered. This is an extension of the keypress trigger – equivalent to keypress of a word-delimiting character such as a space, period, comma, semi-colon, question mark or exclamation mark.
 * Reference insertion: Insertion of a reference via WP:RefToolbar or manual typing (the prototype currently covers only RefToolbar insertion).
 * Paste: Insertion of text via either copy-pasting or drag-and-drop (powered by JS paste and drop events).

On each trigger, the checks configured for that trigger are run, and any concerns are reported to the user in form of a small panel just above the textarea.

Usecases
This is a tentative list of what text reactions could be used for.

Some uses could be undesirable in the long-term. For example, alerting paid editors of the use of peacock language may lead them to avoid it – which may make it harder for editors to detect paid work. Each usecase should be individually discussed before actually being made live.


 * Notify about use of unreliable sources (regexes available from User:Headbomb/unreliable.js)
 * Notify about links made to disambiguation pages (a POC task, such notifications are being integrated into MW)
 * Notify about use of peacock/weasel words. (WP:WTW)

Deployment model
This feature is naturally implemented client-side using JavaScript rather than on the server side to avoid excessive data transfer.

The JavaScript could either be delivered via a MediaWiki extension or as a gadget. The list of text reactions should be fully configurable on-wiki, as policies and guidelines are different across wikis. This makes it suitable to exist as a gadget rather than as an extension, because extensions that require functional JS configurations are frowned upon. Since the feature is targeted at new editors, the gadget should be enabled by default, but needs to be available on just actions=edit.

Supported editors

 * 2010 wikitext editor (the "default" editor) – with or without syntax highlightening.
 * 2017 wikitext editor (Not currently supported in prototype implementation)
 * Mobile editor (source mode) (Not currently supported in prototype implementation)

VisualEditor support needs investigation, but is likely not feasible as it isn't text-based.