Q: How to add Keyboard Shortcut functionality to a HTML button Well I was wondering how can I add Keyboard Shortcuts functionality to a HTML button. For example if you wish to bookmark a webpage you have keyboard shortcuts as CTRL+ D for chrome and safari but I wish to put the same functionality in a button so that when user clicks on it ,it bookmarks the page instead of showing an alert message to use CTRL + D like in this code. 
so can this be done? I have no idea if it's possible, Even popular Addthis buttons display the same alert thing to use ctrl+d like on this site.

A: In HTML, the accesskey attribute allows to define a single letter, and leave handling the modifier keys to the browser and the operating system, to avoid conflicts.
<button aria-label="+ add this" accesskey="a"><span aria-hidden="true">+</span></button>

This is great in theory, but in practice there are some accessibility concerns. The ARIA standard also has a lengthy section on considerations for keyboard shortcuts.
I still would go with this, as it's the best option we currently have. You wouldn't want to handle platform conventions in your code.
You can even retrieve the key combination the browser finally assigned by using the accessKeyLabel attribute, but browser support is not great.
button.title += ` [${button.accessKeyLabel || button.accessKey}]`;

If you are using single character shortcuts, you need to provide a mechanism to change these shortcuts, should they interfere with other AT shortcuts:
Understanding Success Criterion 2.1.4: Character Key Shortcuts
