From f5cf80e6f0fda63095146e0f67e64a695c76eb31 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Wed, 10 Jun 2026 15:38:58 -0400 Subject: [PATCH 1/2] fix unrecognized gui edit error --- src/plot_api/plot_api.js | 1 + test/jasmine/tests/plot_api_react_test.js | 41 +++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/plot_api/plot_api.js b/src/plot_api/plot_api.js index fd46fdedb0f..2c9878ba891 100644 --- a/src/plot_api/plot_api.js +++ b/src/plot_api/plot_api.js @@ -2338,6 +2338,7 @@ var layoutUIControlPatterns = [ { pattern: /^legend\.(x|y)$/, attr: 'editrevision' }, { pattern: /^(shapes|annotations)/, attr: 'editrevision' }, + { pattern: /^selections/, attr: 'selectionrevision' }, { pattern: /^title\.text$/, attr: 'editrevision' } ]; diff --git a/test/jasmine/tests/plot_api_react_test.js b/test/jasmine/tests/plot_api_react_test.js index 40c8e0a3f53..fd59fb3bf5a 100644 --- a/test/jasmine/tests/plot_api_react_test.js +++ b/test/jasmine/tests/plot_api_react_test.js @@ -1544,6 +1544,47 @@ describe('Plotly.react and uirevision attributes', function() { _run(fig, editSelection, checkNoSelection, checkSelection).then(done, done.fail); }); + it('preserves layout selections using selectionrevision without logging unrecognized GUI edits', function(done) { + // Regression test for https://github.com/plotly/plotly.js/issues/7809 + // Check that a box selection is correctly recognized by selectionrevision + // following a call to Plotly.react(), rather than notifying with an + // "unrecognized GUI edit: selections[0]..." error + function fig(mainRev, selectionRev) { + return { + data: [{y: [1, 3, 1]}, {y: [2, 1, 3]}], + layout: { + uirevision: mainRev, + selectionrevision: selectionRev, + dragmode: 'select', + width: 400, + height: 400, + margin: {l: 100, t: 100, r: 100, b: 100} + } + }; + } + + function editSelection() { + return drag({node: document.querySelector('.nsewdrag'), dpos: [148, 100], pos0: [150, 102]}); + } + + function checkNoSelection() { + expect((gd.layout.selections || []).length).toBe(0, 'layout.selections cleared'); + } + function checkSelection() { + expect((gd.layout.selections || []).length).toBe(1, 'layout.selections preserved'); + } + + var warnings = []; + spyOn(Lib, 'warn').and.callFake(function(msg) { warnings.push(msg); }); + + _run(fig, editSelection, checkNoSelection, checkSelection).then(function() { + var guiEditWarnings = warnings.filter(function(msg) { + return String(msg).indexOf('unrecognized GUI edit') !== -1; + }); + expect(guiEditWarnings).toEqual([], 'no unrecognized GUI edit warnings'); + }).then(done, done.fail); + }); + it('preserves polar view changes using polar.uirevision', function(done) { // polar you can control either at the subplot or the axis level function fig(mainRev, polarRev) { From 329517ef811f777c7a1376b3a2d0be0c3397760a Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Wed, 10 Jun 2026 15:43:15 -0400 Subject: [PATCH 2/2] add draftlog --- draftlogs/7836_fix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 draftlogs/7836_fix.md diff --git a/draftlogs/7836_fix.md b/draftlogs/7836_fix.md new file mode 100644 index 00000000000..42cc1bad486 --- /dev/null +++ b/draftlogs/7836_fix.md @@ -0,0 +1 @@ +- Fix "unrecognized GUI edit: selections[0]..." warnings emitted after making a box or lasso selection and then calling `Plotly.react()` [[#7836](https://github.com/plotly/plotly.js/issues/7836)]