Maintain axis length when filtering plot

In my example below I have a plot with two traces, one of which is longer than the other.

If the user filters the plot to only see the second trace the x-axis is zoomed in to only show up to Visit 3.

Is it possible to maintain the same x-axis when filtering the plot so that the user sees up to Visit 4, even when they only select the second trace?

codepen here: https://codepen.io/MayaRGans/pen/bGLexVY?editors=1011

<head>
  <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div id="myDiv"></div>
  <script>
  </script>
</body>
</html>
const trace1 = {
  x: [1, 2, 7, 12, 13], 
  y: [5, 6, 7, 8, 9], 
  type: 'scattergl',
  marker: {
    color: 'black',
    opacity: 1,
    size: 10,
    line: {opacity: 1}
  },
  hoverinfo: 'none'
  //showlegend: false
};

const trace2 = {
  x: [1, 2, 7, 12], 
  y: [1, 2, 3, 4], 
  type: 'scattergl', 
  marker: {
    color: 'black',
    opacity: 1,
    size: 10,
    line: {opacity: 1}
  },
  hoverinfo: 'none'
  //showlegend: false
};

const plotData = [trace1, trace2];

const plotDiv = document.getElementById('myDiv');

layout = {
  dragmode: 'select',
  xaxis: {
    tickvals: [1,2,7,12,13],
    ticktext: ["Baseline", "Visit 1", "Visit 2", "Visit 3", 'Visit 4']
 }
}

Plotly.newPlot(plotDiv, plotData, layout)

I tried using something like this but it’s not working…

plotDiv.on('plotly_legendclick', function(clickData) { 
  Plotly.restyle(plotDiv, 'xaxis.ticktext', [1,2,7,12,13])
  Plotly.restyle(plotDiv, 'xaxis.tickvals', ["Baseline", "Visit 1", "Visit 2", "Visit 3", 'Visit 4'])
})
layout = {
  dragmode: 'select',
  xaxis: {
    tickvals: [1,2,7,12,13],
    ticktext: ["Baseline", "Visit 1", "Visit 2", "Visit 3", 'Visit 4'],
    range: [0,14],
    autorange: false,
    position: 0
 }
}