Material-components-web: [MDCDialog] Adapter's getActionFromEvent returns null

Created on 21 Oct 2019  路  1Comment  路  Source: material-components/material-components-web

Maybe I'm missing something because I couldn't find any past issues about it and I feel like this would be commonly used. Any help is appreciated. Sorry if its not a real bug.

Bug report

getActionFromEvent(event) in MDCDialog's adapter returns null.

Actual behavior

MDCDialog.foundation_.adapter_.getActionFromEvent(event) returns null.

Expected behavior

MDCDialog.foundation_.adapter_.getActionFromEvent(event) returns the event.detail.action.

Your Environment:

| Software | Version(s) |
| ---------------- | ---------- |
| MDC Web | 3.2.0
| Browser | Chrome
| Operating System | Windows 10

Additional context

HTML:

<div class="mdc-dialog" role="alertdialog" aria-modal="true">
        <div class="mdc-dialog__container">
            <div class="mdc-dialog__surface">
                <h2 class="mdc-dialog__title" id="my-dialog-title"></h2>
                <div class="mdc-dialog__content" id="my-dialog-content"></div>
                <footer class="mdc-dialog__actions">
                    <button type="button" class="mdc-button mdc-dialog__button" data-mdc-dialog-action="close">
                        <span class="mdc-button__label">Cancel</span>
                    </button>
                    <button type="button" class="mdc-button mdc-dialog__button" data-mdc-dialog-action="confirm">
                        <span class="mdc-button__label">Confirm</span>
                    </button>
                </footer>
            </div>
        </div>
        <div class="mdc-dialog__scrim"></div>
    </div>

JS:

$('.mdc-dialog').one('MDCDialog:closed', (event) => {
        console.log(JSON.stringify(event.detail)); //returns {"action":"confirm"}
    console.log(event.detail.action); // returns confirm
    console.log(mdcDialog.foundation_.adapter_.getActionFromEvent(event)); //returns null
});
bug

Most helpful comment

Hi, adapter methods are not meant to be used publicly. Is there a use case where this is called within the component and returning null?

>All comments

Hi, adapter methods are not meant to be used publicly. Is there a use case where this is called within the component and returning null?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robzenn92 picture robzenn92  路  4Comments

ronnieroyston picture ronnieroyston  路  3Comments

patrickrodee picture patrickrodee  路  3Comments

trimox picture trimox  路  4Comments

ghost picture ghost  路  3Comments