Skip to content

Incident timeline - remove autofocus directive and add input check

Tristan Read requested to merge tr-tidy-timeline-focus into master

What does this MR do and why?

While working on !95983 (merged) I noticed a couple of minor issues in the code. This MR fixes those.

  1. Removes an unneeded directive from the component. The directive was originally used for autofocus on form opening, but later was replaced with a manual focus call without being fully cleaned up.
  2. Adds a check for a dom node before attempting to focus on it. This allows the parent component to be shallow-mounted / stubbed in test without throwing a JS error.

Screenshots or screen recordings

No visual changes.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Navigate to Monitor -> Incidents.
  2. Create a new incident.
  3. Select the timeline tab.
  4. Select 'Add new timeline event'.
  5. Ensure the date field is still autofocused, as expected.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tristan Read

Merge request reports