Skip to content

Fix editor reloads, Safari hotspots and raw-edit cancellation - #308

Merged
TheWitness merged 6 commits into
Cacti:developfrom
alcatron:fix/editor-reliability-20261016
Oct 17, 2026
Merged

TheWitness merged 6 commits into
Cacti:developfrom
alcatron:fix/editor-reliability-20261016

Conversation

@alcatron

@alcatron alcatron commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

Saving changes could keep a stale editor snapshot, Safari could miss node/note hotspots after scrolling, and cancelling raw edits closed the properties dialog. Refresh the saved document correctly, resolve Safari hotspots in logical coordinates and return Cancel/close to the originating properties without losing its unsaved fields.

Related work

Follow-up to #300, #301 and #303.

Validation

PHP 8.3 isolated Cacti-layout fixture: 292 tests / 5,894 assertions; editor reload, Safari hotspots, raw Cancel and context-menu browser checks. PHP/JavaScript syntax, whitespace and release manifest checks pass.

Coverage was not measured in this local run; current CI and review results must be checked separately.

The reload regression directly loads the editor navigation helpers through a guarded CommonJS export, with no dynamic source evaluation. Reload, return-navigation and context-menu DOM fixtures pass.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Hotspot hover leaves an inline pointer cursor that overrides the crosshair during link placement.

1 open finding
What changed in this PR

This follow-up improves editor refreshes, Safari hotspot selection, and raw-configuration cancellation.

Changes:

  • Reload saved editor snapshots reliably.
  • Resolve image hotspots using logical coordinates.
  • Restore the originating properties dialog and preserve drafts when cancelling raw edits.
File Description
weathermap-cacti-plugin-editor.php Places hotspot data alongside the map image.
tests/​Support/​EditorNotesEngineRegression.php Supplies the map filename for updated markup.
tests/​Browser/​EditorReloadTest.cjs Tests fresh-document reloads and URL cleanup.
tests/​Browser/​EditorHotspotTest.cjs Tests scaled, scrolled hotspot selection.
tests/​Browser/​EditorContextMenuTest.cjs Tests deletion actions and dialog closure.
tests/​Browser/​ConfigCancelTest.cjs Tests cancellation and preserved properties drafts.
js/​editor.js Implements reload, hotspot, and dialog behavior.
CHANGELOG.md Records the editor fixes.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread js/editor.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

No blocking defects were identified, but pending CI results and Safari-specific behavior need final confirmation.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Comment thread tests/Browser/EditorReloadTest.cjs Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Focus restoration targets nonfocusable production anchors, while the regression fixture substitutes focusable buttons.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Make link_edit and node_edit controls programmatically focusable

js/​editor.js:1398

The production #link_edit and #node_edit controls are <a> elements without href or tabindex (weathermap-cacti-plugin-editor.php:514,643), so this call cannot focus them when Cancel, Escape or Close returns to properties. Make the targets programmatically focusable before restoring focus. Also use the production anchor markup in ConfigCancelTest.cjs: its focusable <button> substitutes currently hide this failure.

Review effort: Balanced

@sonarqubecloud

Copy link
Copy Markdown

@alcatron

Copy link
Copy Markdown
Contributor Author

Addressed the latest summary-only focus finding in 4bc9aea. Returning from raw configuration makes the production anchor controls programmatically focusable before restoring focus. ConfigCancelTest now uses the same href-less anchor markup, rather than focusable button substitutes; it fails before this repair and passes after. Cancel/close preserve drafts and navigation remains closed. The full PHP suite passes (292 tests / 5,894 assertions).

These repairs update the PR branch only; the live server has not been changed. New GitHub checks are separate from the passing local validation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Safari-specific hit detection and shared dialog lifecycle changes warrant human confirmation of browser behavior beyond the supplied static review evidence.

No open issues 🎉

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Safari event handling and dialog lifecycle changes need confirmed real-browser validation and current CI results before approval.

No open issues 🎉

Review effort: Balanced

@TheWitness
TheWitness merged commit 9e53cc6 into Cacti:develop Oct 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants