From 4463454ee189d8181f46d89af2dd3702cefb3aa0 Mon Sep 17 00:00:00 2001 From: abdul hamid <113247506+abdulhamid999@users.noreply.github.com> Date: Sat, 5 Dec 2026 00:51:55 +0530 Subject: [PATCH 1/3] Fix _template leak into layout rangeslider options --- draftlogs/0000_fix.md | 1 + src/plots/cartesian/autorange.js | 4 ++- test/jasmine/tests/range_slider_test.js | 39 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 draftlogs/0000_fix.md diff --git a/draftlogs/0000_fix.md b/draftlogs/0000_fix.md new file mode 100644 index 00000000000..2a17ea8c41d --- /dev/null +++ b/draftlogs/0000_fix.md @@ -0,0 +1 @@ +- Fix `_template` property leaking into user `layout` rangeslider axis options [[#0000](https://github.com/plotly/plotly.js/pull/0000)], with thanks to @abdulhamid999 for the contribution! diff --git a/src/plots/cartesian/autorange.js b/src/plots/cartesian/autorange.js index 9113cd855d4..eb45a8b2414 100644 --- a/src/plots/cartesian/autorange.js +++ b/src/plots/cartesian/autorange.js @@ -401,8 +401,10 @@ function doAutoRange(gd, ax, presetRange) { if(axeRangeOpts.rangemode === 'auto') { axeRangeOpts.range = getAutoRange(gd, ax); } + const inputRangeOpts = Lib.extendFlat({}, axeRangeOpts); + delete inputRangeOpts._template; + anchorAx._input.rangeslider[ax._name] = inputRangeOpts; } - anchorAx._input.rangeslider[ax._name] = Lib.extendFlat({}, axeRangeOpts); } } diff --git a/test/jasmine/tests/range_slider_test.js b/test/jasmine/tests/range_slider_test.js index fed44189d9a..0787384ac11 100644 --- a/test/jasmine/tests/range_slider_test.js +++ b/test/jasmine/tests/range_slider_test.js @@ -1221,6 +1221,45 @@ describe('rangesliders in general', function() { }) .then(done, done.fail); }); + + it('should not copy _template into layout rangeslider axis options', (done) => { + Plotly.newPlot(gd, [{ + y: [1, 2, 3] + }], { + xaxis: {rangeslider: {visible: true}} + }) + .then(() => { + expect('_template' in gd.layout.xaxis.rangeslider.yaxis).toBe(false); + expect(gd._fullLayout.xaxis.rangeslider.yaxis._template).toBe(null); + + return Plotly.newPlot(gd, [{ + y: [1, 2, 3] + }], { + xaxis: {rangeslider: {visible: true}}, + template: { + layout: { + xaxis: { + rangeslider: { + yaxis: {rangemode: 'auto'} + } + } + } + } + }); + }) + .then(() => { + expect('_template' in gd.layout.xaxis.rangeslider.yaxis).toBe(false); + expect(gd.layout.xaxis.rangeslider.yaxis.rangemode).toEqual('auto'); + expect(gd._fullLayout.xaxis.rangeslider.yaxis._template).toEqual({rangemode: 'auto'}); + + return Plotly.relayout(gd, 'xaxis.rangeslider.yaxis.rangemode', 'match'); + }) + .then(() => { + expect('_template' in gd.layout.xaxis.rangeslider.yaxis).toBe(false); + expect(gd.layout.xaxis.rangeslider.yaxis.rangemode).toEqual('match'); + }) + .then(done, done.fail); + }); }); function slide(fromX, fromY, toX, toY) { From 08e786795e042ea260f92ef7b0161cf7c194ee7b Mon Sep 17 00:00:00 2001 From: abdul hamid <113247506+abdulhamid999@users.noreply.github.com> Date: Sat, 5 Dec 2026 00:57:48 +0530 Subject: [PATCH 2/3] Update draftlog entry for PR 8229 --- draftlogs/0000_fix.md | 1 - draftlogs/8229_fix.md | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 draftlogs/0000_fix.md create mode 100644 draftlogs/8229_fix.md diff --git a/draftlogs/0000_fix.md b/draftlogs/0000_fix.md deleted file mode 100644 index 2a17ea8c41d..00000000000 --- a/draftlogs/0000_fix.md +++ /dev/null @@ -1 +0,0 @@ -- Fix `_template` property leaking into user `layout` rangeslider axis options [[#0000](https://github.com/plotly/plotly.js/pull/0000)], with thanks to @abdulhamid999 for the contribution! diff --git a/draftlogs/8229_fix.md b/draftlogs/8229_fix.md new file mode 100644 index 00000000000..2d2ea9e7a8d --- /dev/null +++ b/draftlogs/8229_fix.md @@ -0,0 +1 @@ +- Fix `_template` property leaking into user `layout` rangeslider axis options [[#8229](https://github.com/plotly/plotly.js/pull/8229)], with thanks to @abdulhamid999 for the contribution! From cc5f691921dbaed9601520335687f51d54119547 Mon Sep 17 00:00:00 2001 From: abdul hamid <113247506+abdulhamid999@users.noreply.github.com> Date: Sat, 5 Dec 2026 00:58:02 +0530 Subject: [PATCH 3/3] Remove UTF-8 BOM from draftlogs/8229_fix.md --- draftlogs/8229_fix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/draftlogs/8229_fix.md b/draftlogs/8229_fix.md index 2d2ea9e7a8d..c56e7af66d8 100644 --- a/draftlogs/8229_fix.md +++ b/draftlogs/8229_fix.md @@ -1 +1 @@ -- Fix `_template` property leaking into user `layout` rangeslider axis options [[#8229](https://github.com/plotly/plotly.js/pull/8229)], with thanks to @abdulhamid999 for the contribution! +- Fix `_template` property leaking into user `layout` rangeslider axis options [[#8229](https://github.com/plotly/plotly.js/pull/8229)], with thanks to @abdulhamid999 for the contribution!