diff --git a/altair/vegalite/v3/api.py b/altair/vegalite/v3/api.py
index 2b372f35..ceef45ef 100644
--- a/altair/vegalite/v3/api.py
+++ b/altair/vegalite/v3/api.py
@@ -1882,8 +1882,7 @@ class LayerChart(TopLevelMixin, _EncodingMixin, core.TopLevelLayerSpec):
         if not selections or not self.layer:
             return self
         copy = self.copy()
-        copy.layer = [chart.add_selection(*selections)
-                        for chart in copy.layer]
+        copy.layer[0] = copy.layer[0].add_selection(*selections)
         return copy
 
 

Calling add_selection() on a layered chart results in an invalid spec
Example:
```python
import altair as alt
import pandas as pd

df = pd.DataFrame({
    'x': range(5),
    'y1': [1, 3, 2, 4, 5],
    'y2': [2, 1, 4, 5, 3]
})

alt.layer(
  alt.Chart(df).mark_line().encode(x='x', y='y1'),
  alt.Chart(df).mark_line().encode(x='x', y='y2')
).add_selection(
    alt.selection_interval()
)
```
```err
JavaScript Error: Duplicate signal name: "selector012_x_1"

This usually means there's a typo in your chart specification. See the javascript console for the full traceback.
diff --git a/altair/vegalite/v3/tests/test_api.py b/altair/vegalite/v3/tests/test_api.py
index caaa9fc8..8400b3c6 100644
--- a/altair/vegalite/v3/tests/test_api.py
+++ b/altair/vegalite/v3/tests/test_api.py
@@ -535,7 +535,15 @@ def test_facet_add_selections():
     assert chart1.to_dict() == chart2.to_dict()
 
 
-@pytest.mark.parametrize('charttype', [alt.layer, alt.concat, alt.hconcat, alt.vconcat])
+def test_layer_add_selection():
+    base = alt.Chart('data.csv').mark_point()
+    selection = alt.selection_single()
+    chart1 = alt.layer(base.add_selection(selection), base)
+    chart2 = alt.layer(base, base).add_selection(selection)
+    assert chart1.to_dict() == chart2.to_dict()
+
+
+@pytest.mark.parametrize('charttype', [alt.concat, alt.hconcat, alt.vconcat])
 def test_compound_add_selections(charttype):
     base = alt.Chart('data.csv').mark_point()
     selection = alt.selection_single()

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.16
-e git+https://github.com/altair-viz/altair.git@1d80b5979a47b118db67c408d09237a9173ea455#egg=altair
asttokens==3.0.0
attrs==25.3.0
babel==2.17.0
certifi==2025.1.31
charset-normalizer==3.4.1
commonmark==0.9.1
decorator==5.2.1
docutils==0.21.2
entrypoints==0.4
exceptiongroup==1.2.2
executing==2.2.0
flake8==7.2.0
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.1.0
ipython==8.18.1
jedi==0.19.2
Jinja2==3.1.6
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
m2r==0.3.1
MarkupSafe==3.0.2
matplotlib-inline==0.1.7
mccabe==0.7.0
mistune==0.8.4
numpy==2.0.2
packaging==24.2
pandas==2.2.3
parso==0.8.4
pexpect==4.9.0
pluggy==1.5.0
prompt_toolkit==3.0.50
ptyprocess==0.7.0
pure_eval==0.2.3
pycodestyle==2.13.0
pyflakes==3.3.2
Pygments==2.19.1
pytest==8.3.5
python-dateutil==2.9.0.post0
pytz==2025.2
recommonmark==0.7.1
referencing==0.36.2
requests==2.32.3
rpds-py==0.24.0
six==1.17.0
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
tomli==2.2.1
toolz==1.0.0
traitlets==5.14.3
typing_extensions==4.13.0
tzdata==2025.2
urllib3==2.3.0
vega-datasets==0.9.0
wcwidth==0.2.13
zipp==3.21.0

name: altair
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.16
      - asttokens==3.0.0
      - attrs==25.3.0
      - babel==2.17.0
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - commonmark==0.9.1
      - decorator==5.2.1
      - docutils==0.21.2
      - entrypoints==0.4
      - exceptiongroup==1.2.2
      - executing==2.2.0
      - flake8==7.2.0
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==8.6.1
      - iniconfig==2.1.0
      - ipython==8.18.1
      - jedi==0.19.2
      - jinja2==3.1.6
      - jsonschema==4.23.0
      - jsonschema-specifications==2024.10.1
      - m2r==0.3.1
      - markupsafe==3.0.2
      - matplotlib-inline==0.1.7
      - mccabe==0.7.0
      - mistune==0.8.4
      - numpy==2.0.2
      - packaging==24.2
      - pandas==2.2.3
      - parso==0.8.4
      - pexpect==4.9.0
      - pluggy==1.5.0
      - prompt-toolkit==3.0.50
      - ptyprocess==0.7.0
      - pure-eval==0.2.3
      - pycodestyle==2.13.0
      - pyflakes==3.3.2
      - pygments==2.19.1
      - pytest==8.3.5
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - recommonmark==0.7.1
      - referencing==0.36.2
      - requests==2.32.3
      - rpds-py==0.24.0
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==7.4.7
      - sphinxcontrib-applehelp==2.0.0
      - sphinxcontrib-devhelp==2.0.0
      - sphinxcontrib-htmlhelp==2.1.0
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==2.0.0
      - sphinxcontrib-serializinghtml==2.0.0
      - stack-data==0.6.3
      - tomli==2.2.1
      - toolz==1.0.0
      - traitlets==5.14.3
      - typing-extensions==4.13.0
      - tzdata==2025.2
      - urllib3==2.3.0
      - vega-datasets==0.9.0
      - wcwidth==0.2.13
      - zipp==3.21.0
prefix: /opt/conda/envs/altair

altair/vegalite/v3/tests/test_api.py::test_layer_add_selection
altair/vegalite/v3/tests/test_api.py::test_chart_data_types altair/vegalite/v3/tests/test_api.py::test_chart_infer_types altair/vegalite/v3/tests/test_api.py::test_multiple_encodings[args0-kwargs0] altair/vegalite/v3/tests/test_api.py::test_multiple_encodings[args1-kwargs1] altair/vegalite/v3/tests/test_api.py::test_multiple_encodings[args2-kwargs2] altair/vegalite/v3/tests/test_api.py::test_multiple_encodings[args3-kwargs3] altair/vegalite/v3/tests/test_api.py::test_multiple_encodings[args4-kwargs4] altair/vegalite/v3/tests/test_api.py::test_multiple_encodings[args5-kwargs5] altair/vegalite/v3/tests/test_api.py::test_facet[None-chart] altair/vegalite/v3/tests/test_api.py::test_facet[None-layer] altair/vegalite/v3/tests/test_api.py::test_facet[None-facet_encoding] altair/vegalite/v3/tests/test_api.py::test_facet[facet-chart] altair/vegalite/v3/tests/test_api.py::test_facet[facet-layer] altair/vegalite/v3/tests/test_api.py::test_facet[facet-facet_encoding] altair/vegalite/v3/tests/test_api.py::test_facet[row-chart] altair/vegalite/v3/tests/test_api.py::test_facet[row-layer] altair/vegalite/v3/tests/test_api.py::test_facet[row-facet_encoding] altair/vegalite/v3/tests/test_api.py::test_facet[column-chart] altair/vegalite/v3/tests/test_api.py::test_facet[column-layer] altair/vegalite/v3/tests/test_api.py::test_facet[column-facet_encoding] altair/vegalite/v3/tests/test_api.py::test_facet_parse_data altair/vegalite/v3/tests/test_api.py::test_transforms altair/vegalite/v3/tests/test_api.py::test_LookupData altair/vegalite/v3/tests/test_api.py::test_consolidate_datasets altair/vegalite/v3/tests/test_api.py::test_data_property altair/vegalite/v3/tests/test_api.py::test_layer_facet altair/vegalite/v3/tests/test_api.py::test_resolve[layer] altair/vegalite/v3/tests/test_api.py::test_resolve[hconcat] altair/vegalite/v3/tests/test_api.py::test_resolve[vconcat] altair/vegalite/v3/tests/test_api.py::test_resolve[concat] altair/vegalite/v3/tests/test_api.py::test_resolve[facet] altair/vegalite/v3/tests/test_api.py::test_resolve[facet_encoding] altair/vegalite/v3/tests/test_api.py::test_resolve[repeat]
altair/vegalite/v3/tests/test_api.py::test_chart_operations altair/vegalite/v3/tests/test_api.py::test_selection_to_dict altair/vegalite/v3/tests/test_api.py::test_selection_expression altair/vegalite/v3/tests/test_api.py::test_facet_parse altair/vegalite/v3/tests/test_api.py::test_selection altair/vegalite/v3/tests/test_api.py::test_filter_transform_selection_predicates altair/vegalite/v3/tests/test_api.py::test_resolve_methods altair/vegalite/v3/tests/test_api.py::test_layer_encodings altair/vegalite/v3/tests/test_api.py::test_add_selection altair/vegalite/v3/tests/test_api.py::test_repeat_add_selections altair/vegalite/v3/tests/test_api.py::test_facet_add_selections altair/vegalite/v3/tests/test_api.py::test_compound_add_selections[concat] altair/vegalite/v3/tests/test_api.py::test_compound_add_selections[hconcat] altair/vegalite/v3/tests/test_api.py::test_compound_add_selections[vconcat] altair/vegalite/v3/tests/test_api.py::test_selection_property altair/vegalite/v3/tests/test_api.py::test_themes altair/vegalite/v3/tests/test_api.py::test_chart_from_dict altair/vegalite/v3/tests/test_api.py::test_consolidate_InlineData altair/vegalite/v3/tests/test_api.py::test_deprecated_encodings altair/vegalite/v3/tests/test_api.py::test_repeat altair/vegalite/v3/tests/test_api.py::test_subcharts_with_same_data[data.json-layer] altair/vegalite/v3/tests/test_api.py::test_subcharts_with_same_data[data.json-hconcat] altair/vegalite/v3/tests/test_api.py::test_subcharts_with_same_data[data.json-vconcat] altair/vegalite/v3/tests/test_api.py::test_subcharts_with_same_data[data.json-concat] altair/vegalite/v3/tests/test_api.py::test_subcharts_with_same_data[data1-layer] altair/vegalite/v3/tests/test_api.py::test_subcharts_with_same_data[data1-hconcat] altair/vegalite/v3/tests/test_api.py::test_subcharts_with_same_data[data1-vconcat] altair/vegalite/v3/tests/test_api.py::test_subcharts_with_same_data[data1-concat] altair/vegalite/v3/tests/test_api.py::test_subcharts_different_data[data.json-layer] altair/vegalite/v3/tests/test_api.py::test_subcharts_different_data[data.json-hconcat] altair/vegalite/v3/tests/test_api.py::test_subcharts_different_data[data.json-vconcat] altair/vegalite/v3/tests/test_api.py::test_subcharts_different_data[data.json-concat] altair/vegalite/v3/tests/test_api.py::test_subcharts_different_data[data1-layer] altair/vegalite/v3/tests/test_api.py::test_subcharts_different_data[data1-hconcat] altair/vegalite/v3/tests/test_api.py::test_subcharts_different_data[data1-vconcat] altair/vegalite/v3/tests/test_api.py::test_subcharts_different_data[data1-concat] altair/vegalite/v3/tests/test_api.py::test_layer_errors altair/vegalite/v3/tests/test_api.py::test_sequence altair/vegalite/v3/tests/test_api.py::test_graticule altair/vegalite/v3/tests/test_api.py::test_sphere
altair/vegalite/v3/api.py
altair/vegalite/v3/api.py