ampproject / ampproject/amphtml

Allow binding to amp-selector option[disabled]

Open
#38,424 1 comment 0 reactions 0 assignees View on GitHub
Component: amp-bind Type: Feature Request WG: components
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

#13036 fixed it such that `` supported binding to the `disabled` attribute.

The [docs](https://amp.dev/documentation/components/amp-selector/#disabled,-selected) say that options can also be disabled but apparently not via binding:

`[object HTMLDivElement]: Binding to [%s] on <%s> is not allowed. amp-bind disabled DIV`

when I try to do:

```html


Option

```

and yet it works fine for me to do:

```html


Option

```

### Alternatives Considered

I am currently working around this by using a bound class which applies `pointer-events: none`:

```html


Option

```

### Additional Context

In my case, this is essential as I need to be able to disable all other options once a threshold has been reached.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported amp-selector example with a bound disabled attribute, then trace how amp-bind validates bindings on option elements. Done means an option's disabled state can be controlled through binding as described, without the reported error, while preserving the existing static disabled behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.