Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export class Select {
clickHandler(event) {
const {type} = event.target.dataset

if (type === 'input') {
if (type === 'input' || event.target.closest('.select__input')) {
// клик может прийтись не только по input, но и по содежащемуся внутри него span
this.toggle()
} else if (type === 'item') {
const id = event.target.dataset.id
Expand Down Expand Up @@ -104,4 +105,4 @@ export class Select {
this.$el.removeEventListener('click', this.clickHandler)
this.$el.innerHTML = ''
}
}
}