How to use title attributes in sidebar widget?

You’r missing $post variable ( it is not defined and that for you don’t get post_name ).

As a solution you could add global $post;

You’r code would be like:

<a href="https://wordpress.stackexchange.com/questions/201956/<?php echo site_url("/article/full-text/'); global $post;
$slug = $post->post_name; echo $slug; ?>" title="<?php the_title_attribute(); ?>">Full Text</a>