Skip to content

[Rating] [dispose() method throws an error] #2006

@Nikitossik

Description

@Nikitossik

Describe the bug
I have an instance of the Rating component. When I call dispose(), the error occurs:
image

Show your code
There is an Internal server error when I try to add a playgound, so this is my code:
import { Rating, initTE } from "tw-elements";

initTE({ Rating });

const diffRatingEl = document.getElementById('difficulty-rating');

let diffRating = new Rating(diffRatingEl);
diffRating.dispose();

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Version: 118.0.5993.70

Additional context
I looked up the code of rating in node_modules\tw-elements\dist\src\js\components\rating.js:
this._icons.removeAttribute("tabIndex");
this._icons prop is supposed to be an array, so it's obvious that removeAttribute() is not a function, instead we should run this on every icon:
this._icons.forEach(el => el.removeAttribute("tabIndex"));

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions