Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow notification banner config set via data attributes to be passed when initialising the component in JavaScript #2839

Closed
4 tasks done
36degrees opened this issue Sep 12, 2022 · 0 comments · Fixed by #2843

Comments

@36degrees
Copy link
Contributor

36degrees commented Sep 12, 2022

What

The notification banner component currently uses a data-disable-auto-focus data attribute to prevent the component from taking focus on page load. (This is mostly designed to be used when the component is displayed in a different context, e.g. in the Design System itself)

Update the component so that the config can also be passed as an object when initialising the component in JavaScript.

As per #1708 (comment), any config passed via data attributes takes precedence over config passed when initialising a component.

Why

This aligns the general concept of 'component config' with the approach we're using for internationalisation.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • The 'disable auto focus' functionality can be provided when instantiating a NotificationBanner object
  • The 'prevent double click' functionality can be provided when instantiating a NotificationBanner object via initAll
  • If a data-disable-auto-focus data attribute is present on the $module HTML element it overrides any config set via initialisation
  • Tests to cover the above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment