mirror of
https://github.com/Mastermindzh/react-cookie-consent.git
synced 2025-01-20 18:41:44 +01:00
added aria label capabilities for both buttons
This commit is contained in:
parent
b1913d223e
commit
5e4e8406e6
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [[5.2.0](https://github.com/Mastermindzh/react-cookie-consent/releases/tag/5.2.0)]
|
||||||
|
|
||||||
|
### added
|
||||||
|
|
||||||
|
Added aria labels for both the decline and accept button
|
||||||
|
|
||||||
## [[5.1.4](https://github.com/Mastermindzh/react-cookie-consent/releases/tag/5.1.4)]
|
## [[5.1.4](https://github.com/Mastermindzh/react-cookie-consent/releases/tag/5.1.4)]
|
||||||
|
|
||||||
### changed
|
### changed
|
||||||
|
2
build/index.d.ts
vendored
2
build/index.d.ts
vendored
@ -39,6 +39,8 @@ export interface CookieConsentProps {
|
|||||||
overlay?: boolean;
|
overlay?: boolean;
|
||||||
overlayClasses?: string;
|
overlayClasses?: string;
|
||||||
overlayStyle?: object;
|
overlayStyle?: object;
|
||||||
|
ariaAcceptLabel?: string;
|
||||||
|
ariaDeclineLabel?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class CookieConsent extends React.Component<CookieConsentProps, {}> {}
|
export default class CookieConsent extends React.Component<CookieConsentProps, {}> {}
|
||||||
|
@ -913,7 +913,9 @@ module.exports = /******/ (function (modules) {
|
|||||||
ButtonComponent = _props4.ButtonComponent,
|
ButtonComponent = _props4.ButtonComponent,
|
||||||
overlay = _props4.overlay,
|
overlay = _props4.overlay,
|
||||||
overlayClasses = _props4.overlayClasses,
|
overlayClasses = _props4.overlayClasses,
|
||||||
overlayStyle = _props4.overlayStyle;
|
overlayStyle = _props4.overlayStyle,
|
||||||
|
ariaAcceptLabel = _props4.ariaAcceptLabel,
|
||||||
|
ariaDeclineLabel = _props4.ariaDeclineLabel;
|
||||||
|
|
||||||
var myStyle = {};
|
var myStyle = {};
|
||||||
var myButtonStyle = {};
|
var myButtonStyle = {};
|
||||||
@ -970,6 +972,7 @@ module.exports = /******/ (function (modules) {
|
|||||||
style: myDeclineButtonStyle,
|
style: myDeclineButtonStyle,
|
||||||
className: declineButtonClasses,
|
className: declineButtonClasses,
|
||||||
id: declineButtonId,
|
id: declineButtonId,
|
||||||
|
"aria-label": ariaDeclineLabel,
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
_this2.decline();
|
_this2.decline();
|
||||||
},
|
},
|
||||||
@ -987,6 +990,7 @@ module.exports = /******/ (function (modules) {
|
|||||||
style: myButtonStyle,
|
style: myButtonStyle,
|
||||||
className: buttonClasses,
|
className: buttonClasses,
|
||||||
id: buttonId,
|
id: buttonId,
|
||||||
|
"aria-label": ariaAcceptLabel,
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
_this2.accept({ acceptedByScrolling: false });
|
_this2.accept({ acceptedByScrolling: false });
|
||||||
},
|
},
|
||||||
@ -1098,6 +1102,8 @@ module.exports = /******/ (function (modules) {
|
|||||||
overlay: _propTypes2.default.bool,
|
overlay: _propTypes2.default.bool,
|
||||||
overlayClasses: _propTypes2.default.string,
|
overlayClasses: _propTypes2.default.string,
|
||||||
overlayStyle: _propTypes2.default.object,
|
overlayStyle: _propTypes2.default.object,
|
||||||
|
ariaAcceptLabel: _propTypes2.default.string,
|
||||||
|
ariaDeclineLabel: _propTypes2.default.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
CookieConsent.defaultProps = {
|
CookieConsent.defaultProps = {
|
||||||
@ -1137,6 +1143,8 @@ module.exports = /******/ (function (modules) {
|
|||||||
},
|
},
|
||||||
overlay: false,
|
overlay: false,
|
||||||
overlayClasses: "",
|
overlayClasses: "",
|
||||||
|
ariaAcceptLabel: "Accept cookies",
|
||||||
|
ariaDeclineLabel: "Decline cookies",
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.default = CookieConsent;
|
exports.default = CookieConsent;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"name": "Rick van Lieshout",
|
"name": "Rick van Lieshout",
|
||||||
"email": "info@rickvanlieshout.com"
|
"email": "info@rickvanlieshout.com"
|
||||||
},
|
},
|
||||||
"version": "5.1.4",
|
"version": "5.2.0",
|
||||||
"description": "A small, simple and customizable cookie consent bar for use in React applications.",
|
"description": "A small, simple and customizable cookie consent bar for use in React applications.",
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"types": "build/index.d.ts",
|
"types": "build/index.d.ts",
|
||||||
|
10
src/index.d.ts
vendored
10
src/index.d.ts
vendored
@ -24,7 +24,7 @@ export interface CookieConsentProps {
|
|||||||
expires?: number;
|
expires?: number;
|
||||||
containerClasses?: string;
|
containerClasses?: string;
|
||||||
contentClasses?: string;
|
contentClasses?: string;
|
||||||
buttonWrapperClasses?: string,
|
buttonWrapperClasses?: string;
|
||||||
buttonClasses?: string;
|
buttonClasses?: string;
|
||||||
declineButtonClasses?: string;
|
declineButtonClasses?: string;
|
||||||
buttonId?: string;
|
buttonId?: string;
|
||||||
@ -36,9 +36,11 @@ export interface CookieConsentProps {
|
|||||||
enableDeclineButton?: boolean;
|
enableDeclineButton?: boolean;
|
||||||
flipButtons?: boolean;
|
flipButtons?: boolean;
|
||||||
ButtonComponent?: React.ElementType;
|
ButtonComponent?: React.ElementType;
|
||||||
overlay?: boolean,
|
overlay?: boolean;
|
||||||
overlayClasses?: string,
|
overlayClasses?: string;
|
||||||
overlayStyle?: object,
|
overlayStyle?: object;
|
||||||
|
ariaAcceptLabel?: string;
|
||||||
|
ariaDeclineLabel?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class CookieConsent extends React.Component<CookieConsentProps, {}> {}
|
export default class CookieConsent extends React.Component<CookieConsentProps, {}> {}
|
||||||
|
@ -249,6 +249,8 @@ class CookieConsent extends Component {
|
|||||||
overlay,
|
overlay,
|
||||||
overlayClasses,
|
overlayClasses,
|
||||||
overlayStyle,
|
overlayStyle,
|
||||||
|
ariaAcceptLabel,
|
||||||
|
ariaDeclineLabel,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
let myStyle = {};
|
let myStyle = {};
|
||||||
@ -304,6 +306,7 @@ class CookieConsent extends Component {
|
|||||||
style={myDeclineButtonStyle}
|
style={myDeclineButtonStyle}
|
||||||
className={declineButtonClasses}
|
className={declineButtonClasses}
|
||||||
id={declineButtonId}
|
id={declineButtonId}
|
||||||
|
aria-label={ariaDeclineLabel}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.decline();
|
this.decline();
|
||||||
}}
|
}}
|
||||||
@ -319,6 +322,7 @@ class CookieConsent extends Component {
|
|||||||
style={myButtonStyle}
|
style={myButtonStyle}
|
||||||
className={buttonClasses}
|
className={buttonClasses}
|
||||||
id={buttonId}
|
id={buttonId}
|
||||||
|
aria-label={ariaAcceptLabel}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.accept({ acceptedByScrolling: false });
|
this.accept({ acceptedByScrolling: false });
|
||||||
}}
|
}}
|
||||||
@ -394,6 +398,8 @@ CookieConsent.propTypes = {
|
|||||||
overlay: PropTypes.bool,
|
overlay: PropTypes.bool,
|
||||||
overlayClasses: PropTypes.string,
|
overlayClasses: PropTypes.string,
|
||||||
overlayStyle: PropTypes.object,
|
overlayStyle: PropTypes.object,
|
||||||
|
ariaAcceptLabel: PropTypes.string,
|
||||||
|
ariaDeclineLabel: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
CookieConsent.defaultProps = {
|
CookieConsent.defaultProps = {
|
||||||
@ -428,6 +434,8 @@ CookieConsent.defaultProps = {
|
|||||||
ButtonComponent: ({ children, ...props }) => <button {...props}>{children}</button>,
|
ButtonComponent: ({ children, ...props }) => <button {...props}>{children}</button>,
|
||||||
overlay: false,
|
overlay: false,
|
||||||
overlayClasses: "",
|
overlayClasses: "",
|
||||||
|
ariaAcceptLabel: "Accept cookies",
|
||||||
|
ariaDeclineLabel: "Decline cookies",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CookieConsent;
|
export default CookieConsent;
|
||||||
|
Loading…
Reference in New Issue
Block a user